Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "ignorePatterns": [] }
9 changes: 6 additions & 3 deletions src/collator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const types = @import("types");
const util = @import("util");

pub const Collator = struct {
pub const InitError = error{OutOfMemory};
pub const CollateError = error{OutOfMemory};

alloc: std.mem.Allocator,

table: types.CollationTable = .cldr,
Expand Down Expand Up @@ -41,7 +44,7 @@ pub const Collator = struct {
table: types.CollationTable,
shifting: bool,
tiebreak: bool,
) !Collator {
) InitError!Collator {
const low_table: [183]u32 = if (table == .cldr) consts.LOW_CLDR else consts.LOW;

var coll = Collator{
Expand Down Expand Up @@ -78,7 +81,7 @@ pub const Collator = struct {
return coll;
}

pub fn initDefault(alloc: std.mem.Allocator) !Collator {
pub fn initDefault(alloc: std.mem.Allocator) InitError!Collator {
return try Collator.init(alloc, .cldr, true, true);
}

Expand All @@ -99,7 +102,7 @@ pub const Collator = struct {
// Collation
//

pub fn collate(self: *Collator, a: []const u8, b: []const u8) !std.math.Order {
pub fn collate(self: *Collator, a: []const u8, b: []const u8) CollateError!std.math.Order {
if (std.mem.eql(u8, a, b)) return .eq;

// Decode function clears input list
Expand Down
Loading