Function fromSlice [src]
Parses the given slice as ZON.
Returns error.OutOfMemory on allocation failure, or error.ParseZon error if the ZON is
invalid or can not be deserialized into type T.
When the parser returns error.ParseZon, it will also store a human readable explanation in
diag if non null. If diag is not null, it must be initialized to .{}.
Asserts at compile time that the result type doesn't contain pointers. As such, the result
doesn't need to be freed.
An allocator is still required for temporary allocations made during parsing.
Prototype
pub fn fromSlice( T: type, gpa: Allocator, source: [:0]const u8, diag: ?*Diagnostics, options: Options, ) error{ OutOfMemory, ParseZon }!T
Parameters
T: type
gpa: Allocator
source: [:0]const u8
diag: ?*Diagnostics
options: Options
Possible Errors
Source
pub fn fromSlice(
T: type,
gpa: Allocator,
source: [:0]const u8,
diag: ?*Diagnostics,
options: Options,
) error{ OutOfMemory, ParseZon }!T {
comptime assert(!requiresAllocator(T));
return fromSliceAlloc(T, gpa, source, diag, options);
}