Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › zon/ › Serializer.zig › tupleImpl
tupleImpl
Serializer.tupleImpl
fn tupleImpl (self : *Serializer , val : anytype , options : ValueOptions ) Error !void
File
Code
fn tupleImpl (self : *Serializer , val : anytype , options : ValueOptions ) Error !void {
comptime assertCanSerializeType (@TypeOf (val ));
switch (@typeInfo (@TypeOf (val ))) {
.@"struct" => {
var container = try self .beginTuple (.{ .whitespace_style = .{ .fields = val .len } });
inline for (val ) |item_val | {
try container .fieldArbitraryDepth (item_val , options );
}
try container .end ();
},
.pointer , .array => {
var container = try self .beginTuple (.{ .whitespace_style = .{ .fields = val .len } });
for (val ) |item_val | {
try container .fieldArbitraryDepth (item_val , options );
}
try container .end ();
},
else => comptime unreachable ,
}
}