Skip to content

Commit

Permalink
Some fixes from downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
llogick authored Dec 9, 2023
1 parent 956d76d commit 5feff91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/base.zig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn Map(comptime Key: type, comptime Value: type) type {
pub fn UnionParser(comptime T: type) type {
return struct {
pub fn jsonParse(allocator: std.mem.Allocator, source: anytype, options: std.json.ParseOptions) std.json.ParseError(@TypeOf(source.*))!T {
const json_value = try std.json.parseFromTokenSourceLeaky(std.json.Value, allocator, source, options);
const json_value = try std.json.Value.jsonParse(allocator, source, options);
return try jsonParseFromValue(allocator, json_value, options);
}

Expand All @@ -95,7 +95,7 @@ pub fn EnumCustomStringValues(comptime T: type, comptime contains_empty_enum: bo
const KV = struct { []const u8, T };
const fields = @typeInfo(T).Union.fields;
var kvs_array: [fields.len - 1]KV = undefined;
inline for (fields[0 .. fields.len - 1], 0..) |field, i| {
for (fields[0 .. fields.len - 1], 0..) |field, i| {
kvs_array[i] = .{ field.name, @field(T, field.name) };
}
break :build_kvs kvs_array[0..];
Expand Down

0 comments on commit 5feff91

Please sign in to comment.