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.

partialStringCodepoint

Scanner.partialStringCodepoint
fn partialStringCodepoint(code_point: u21) Token

File

lib/std/json/Scanner.zig:1382

Code

fn partialStringCodepoint(code_point: u21) Token {
    var buf: [4]u8 = undefined;
    switch (std.unicode.utf8Encode(code_point, &buf) catch unreachable) {
        1 => return Token{ .partial_string_escaped_1 = buf[0..1].* },
        2 => return Token{ .partial_string_escaped_2 = buf[0..2].* },
        3 => return Token{ .partial_string_escaped_3 = buf[0..3].* },
        4 => return Token{ .partial_string_escaped_4 = buf[0..4].* },
        else => unreachable,
    }
}