diff options
| author | 2024-08-30 12:33:10 +0200 | |
|---|---|---|
| committer | 2024-08-30 16:46:05 +0200 | |
| commit | 2d9db156ae928860a9acf2f1260750d3b44a4c98 (patch) | |
| tree | 56897fe054cc55491d4b41ecf8c53a55f40a9952 | |
| parent | count codepoints instead of bytes, to determine width (diff) | |
| download | zig-clap-2d9db156ae928860a9acf2f1260750d3b44a4c98.tar.gz zig-clap-2d9db156ae928860a9acf2f1260750d3b44a4c98.tar.xz zig-clap-2d9db156ae928860a9acf2f1260750d3b44a4c98.zip | |
adapt to latest zig changes
| -rw-r--r-- | clap.zig | 6 | ||||
| -rw-r--r-- | clap/parsers.zig | 4 |
2 files changed, 5 insertions, 5 deletions
| @@ -767,7 +767,7 @@ pub fn parseEx( | |||
| 767 | // fields to slices and return that. | 767 | // fields to slices and return that. |
| 768 | var result_args = Arguments(Id, params, value_parsers, .slice){}; | 768 | var result_args = Arguments(Id, params, value_parsers, .slice){}; |
| 769 | inline for (meta.fields(@TypeOf(arguments))) |field| { | 769 | inline for (meta.fields(@TypeOf(arguments))) |field| { |
| 770 | if (@typeInfo(field.type) == .Struct and | 770 | if (@typeInfo(field.type) == .@"struct" and |
| 771 | @hasDecl(field.type, "toOwnedSlice")) | 771 | @hasDecl(field.type, "toOwnedSlice")) |
| 772 | { | 772 | { |
| 773 | const slice = try @field(arguments, field.name).toOwnedSlice(allocator); | 773 | const slice = try @field(arguments, field.name).toOwnedSlice(allocator); |
| @@ -884,7 +884,7 @@ fn deinitArgs( | |||
| 884 | // If the multi value field is a struct, we know it is a list and should be deinited. | 884 | // If the multi value field is a struct, we know it is a list and should be deinited. |
| 885 | // Otherwise, it is a slice that should be freed. | 885 | // Otherwise, it is a slice that should be freed. |
| 886 | switch (@typeInfo(@TypeOf(field))) { | 886 | switch (@typeInfo(@TypeOf(field))) { |
| 887 | .Struct => @field(arguments, longest.name).deinit(allocator), | 887 | .@"struct" => @field(arguments, longest.name).deinit(allocator), |
| 888 | else => allocator.free(@field(arguments, longest.name)), | 888 | else => allocator.free(@field(arguments, longest.name)), |
| 889 | } | 889 | } |
| 890 | } | 890 | } |
| @@ -937,7 +937,7 @@ fn Arguments( | |||
| 937 | i += 1; | 937 | i += 1; |
| 938 | } | 938 | } |
| 939 | 939 | ||
| 940 | return @Type(.{ .Struct = .{ | 940 | return @Type(.{ .@"struct" = .{ |
| 941 | .layout = .auto, | 941 | .layout = .auto, |
| 942 | .fields = &fields, | 942 | .fields = &fields, |
| 943 | .decls = &.{}, | 943 | .decls = &.{}, |
diff --git a/clap/parsers.zig b/clap/parsers.zig index 874c23b..8abdf57 100644 --- a/clap/parsers.zig +++ b/clap/parsers.zig | |||
| @@ -92,9 +92,9 @@ test "enumeration" { | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | fn ReturnType(comptime P: type) type { | 94 | fn ReturnType(comptime P: type) type { |
| 95 | return @typeInfo(P).Fn.return_type.?; | 95 | return @typeInfo(P).@"fn".return_type.?; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | pub fn Result(comptime P: type) type { | 98 | pub fn Result(comptime P: type) type { |
| 99 | return @typeInfo(ReturnType(P)).ErrorUnion.payload; | 99 | return @typeInfo(ReturnType(P)).error_union.payload; |
| 100 | } | 100 | } |