diff --git a/src/parser.zig b/src/parser.zig index bbf0a62..01c9420 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -80,10 +80,8 @@ pub const Options = struct { // an error if the destination is a boolean type. By default, these comparisons are // case-sensitive. See the `case_insensitive_scalar_coersion` option to change // this. - boolean_scalars: struct { truthy: []const []const u8, falsy: []const []const u8 } = .{ - .truthy = &.{ "true", "True", "yes", "on" }, - .falsy = &.{ "false", "False", "no", "off" }, - }, + truthy_boolean_scalars: []const []const u8 = &.{ "true", "True", "yes", "on" }, + falsy_boolean_scalars: []const []const u8 = &.{ "false", "False", "no", "off" }, // Only used by the parseTo family of functions. // A list of strings. Scalars in the doucment that match any of the values listed diff --git a/src/parser/value.zig b/src/parser/value.zig index 191b8ce..f1795b4 100644 --- a/src/parser/value.zig +++ b/src/parser/value.zig @@ -82,14 +82,14 @@ pub const Value = union(enum) { inline .scalar, .string => |str, tag| { if (tag == .string and !options.coerce_strings) return error.BadValue; if (options.case_insensitive_scalar_coersion) { - for (options.boolean_scalars.truthy) |check| + for (options.truthy_boolean_scalars) |check| if (std.ascii.eqlIgnoreCase(str, check)) return true; - for (options.boolean_scalars.falsy) |check| + for (options.falsy_boolean_scalars) |check| if (std.ascii.eqlIgnoreCase(str, check)) return false; } else { - for (options.boolean_scalars.truthy) |check| + for (options.truthy_boolean_scalars) |check| if (std.mem.eql(u8, str, check)) return true; - for (options.boolean_scalars.falsy) |check| + for (options.falsy_boolean_scalars) |check| if (std.mem.eql(u8, str, check)) return false; }