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.

codepointForDisplay

errors.codepointForDisplay
fn codepointForDisplay(codepoint: code_pages.Codepoint) ?u21

File

Code

fn codepointForDisplay(codepoint: code_pages.Codepoint) ?u21 {
    return switch (codepoint.value) {
        '\x00'...'\x08',
        '\x0E'...'\x1F',
        '\x7F',
        code_pages.Codepoint.invalid,
        => '�',
        // \r is seemingly ignored by the RC compiler so skipping it when printing source lines
        // could help avoid confusing output (e.g. RC\rDATA if printed verbatim would show up
        // in the console as DATA but the compiler reads it as RCDATA)
        //
        // NOTE: This is irrelevant when using the clang preprocessor, because unpaired \r
        //       characters get converted to \n, but may become relevant if another
        //       preprocessor is used instead.
        '\r' => null,
        '\t', '\x0B', '\x0C' => ' ',
        else => |v| v,
    };
}