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.

safety_checks_hint

The safety_checks_hint parameter determines how much memory is used to enable assertions that the above grammar is being followed, e.g. tripping an assertion rather than allowing endObject to emit the final } in [[[]]}. "Depth" in this context means the depth of nested [] or {} expressions (or equivalently the amount of recursion on the <value> grammar expression above). For example, emitting the JSON [[[]]] requires a depth of 3. If .checked_to_fixed_depth is used, there is additionally an assertion that the nesting depth never exceeds the given limit. .checked_to_fixed_depth embeds the storage required in the Stringify struct. .assumed_correct requires no space and performs none of these assertions. In fast and small optimization modes, the given safety_checks_hint is ignored and is always treated as .assumed_correct.

Stringify.safety_checks_hint
const safety_checks_hint: union(enum)

File

lib/std/json/Stringify.zig:70

Code

const safety_checks_hint: union(enum) {
    /// Rounded up to the nearest multiple of 8.
    checked_to_fixed_depth: usize,
    assumed_correct,
} = .{ .checked_to_fixed_depth = 256 }