Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 Function

takeValueSliceMinusTrailingOffset

Private Function
std.json.Scanner.takeValueSliceMinusTrailingOffset
fn takeValueSliceMinusTrailingOffset(self: *@This(), trailing_negative_offset: usize) []const u8

Params

  • self: *@This()
  • trailing_negative_offset: usize

File

json/Scanner.zig:1326
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
fn takeValueSliceMinusTrailingOffset(self: *@This(), trailing_negative_offset: usize) []const u8 {
    // Check if the escape sequence started before the current input buffer.
    // (The algebra here is awkward to avoid unsigned underflow,
    //  but it's just making sure the slice on the next line isn't UB.)
    if (self.cursor <= self.value_start + trailing_negative_offset) return "";
    const slice = self.input[self.value_start .. self.cursor - trailing_negative_offset];
    // When trailing_negative_offset is non-zero, setting self.value_start doesn't matter,
    // because we always set it again while emitting the .partial_string_escaped_*.
    self.value_start = self.cursor;
    return slice;
}