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.

parseFromSlice

Parses the json document from s and returns the result packaged in a std.json.Parsed. You must call deinit() of the returned object to clean up allocated resources. If you are using a std.heap.ArenaAllocator or similar, consider calling parseFromSliceLeaky instead. Note that error.BufferUnderrun is not actually possible to return from this function.

static.parseFromSlice
pub fn parseFromSlice(
    comptime T: type,
    allocator: Allocator,
    s: []const u8,
    options: ParseOptions,
) ParseError(Scanner)!Parsed(T)

File

lib/std/json/static.zig:74

Code

pub fn parseFromSlice(
    comptime T: type,
    allocator: Allocator,
    s: []const u8,
    options: ParseOptions,
) ParseError(Scanner)!Parsed(T) {
    var scanner = Scanner.initCompleteInput(allocator, s);
    defer scanner.deinit();

    return parseFromTokenSource(T, allocator, &scanner, options);
}