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 standard library. Private Constant
safety_checks_hint
Private Constant
std.json.Stringify.safety_checks_hint
constsafety_checks_hint: union(enum)
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.
File
json/Stringify.zig:70
7071727374
constsafety_checks_hint: union(enum) {
/// Rounded up to the nearest multiple of 8.checked_to_fixed_depth: usize,
assumed_correct,
} = .{ .checked_to_fixed_depth = 256 }
The
safety_checks_hintparameter determines how much memory is used to enable assertions that the above grammar is being followed, e.g. tripping an assertion rather than allowingendObjectto 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_depthis used, there is additionally an assertion that the nesting depth never exceeds the given limit..checked_to_fixed_depthembeds the storage required in theStringifystruct..assumed_correctrequires no space and performs none of these assertions. In fast and small optimization modes, the givensafety_checks_hintis ignored and is always treated as.assumed_correct.