Function serialize [src]
Serialize the given value as ZON.
It is asserted at comptime that @TypeOf(val) is not a recursive type.
Prototype
pub fn serialize( val: anytype, options: SerializeOptions, writer: anytype, ) @TypeOf(writer).Error!void
Parameters
options: SerializeOptions
Source
pub fn serialize(
val: anytype,
options: SerializeOptions,
writer: anytype,
) @TypeOf(writer).Error!void {
var sz = serializer(writer, .{
.whitespace = options.whitespace,
});
try sz.value(val, .{
.emit_codepoint_literals = options.emit_codepoint_literals,
.emit_strings_as_containers = options.emit_strings_as_containers,
.emit_default_optional_fields = options.emit_default_optional_fields,
});
}