@@ -5,11 +5,10 @@ const utils = @import("./utils.zig");
55const Field = std .builtin .Type .StructField ;
66const testing = std .testing ;
77
8- // See https://github.com/ziglang/zig/pull/18061
9- pub const TraitFn = fn (type ) callconv (.Inline ) bool ;
8+ pub const TraitFn = fn (type ) bool ;
109pub fn is (comptime id : std.builtin.TypeId ) TraitFn {
1110 const Closure = struct {
12- pub inline fn trait (comptime T : type ) bool {
11+ pub fn trait (comptime T : type ) bool {
1312 return id == @typeInfo (T );
1413 }
1514 };
@@ -196,8 +195,8 @@ pub const StructEnv = struct {
196195 const C = comptime meta .Child (T );
197196 // TODO: delimiter
198197 var it = std .mem .splitSequence (u8 , v , "," );
199- var new_value = std .ArrayList (C ). init ( self . allocator ) ;
200- defer new_value .deinit ();
198+ var new_value = std .ArrayList (C ){} ;
199+ defer new_value .deinit (self . allocator );
201200
202201 while (it .next ()) | s | {
203202 const item = switch (C ) {
@@ -210,17 +209,17 @@ pub const StructEnv = struct {
210209 else = > @compileError ("Unsupported deserialization type" ++ @typeName (C ) ++ "\n " ),
211210 },
212211 };
213- try new_value .append (item );
212+ try new_value .append (self . allocator , item );
214213 }
215214
216- return new_value .toOwnedSlice ();
215+ return try new_value .toOwnedSlice (self . allocator );
217216 }
218217
219218 const default_value = self .getDefault (T , field );
220219 if (default_value ) | v | {
221220 const C = comptime meta .Child (T );
222- var new_value = std .ArrayList (C ). init ( self . allocator ) ;
223- defer new_value .deinit ();
221+ var new_value = std .ArrayList (C ){} ;
222+ defer new_value .deinit (self . allocator );
224223
225224 for (v ) | s | {
226225 const item = switch (C ) {
@@ -232,10 +231,10 @@ pub const StructEnv = struct {
232231 else = > @compileError ("Unsupported deserialization type" ++ @typeName (C ) ++ "\n " ),
233232 },
234233 };
235- try new_value .append (item );
234+ try new_value .append (self . allocator , item );
236235 }
237236
238- return new_value .toOwnedSlice ();
237+ return try new_value .toOwnedSlice (self . allocator );
239238 }
240239
241240 return Error .NotExist ;
0 commit comments