Function slice1 [src]

Reduces a slice to account for the limit, leaving room for one extra byte above the limit, allowing for the use case of differentiating between end-of-stream and reaching the limit.

Prototype

pub fn slice1(l: Limit, non_empty_buffer: []u8) []u8

Parameters

l: Limitnon_empty_buffer: []u8

Source

pub fn slice1(l: Limit, non_empty_buffer: []u8) []u8 { assert(non_empty_buffer.len >= 1); return non_empty_buffer[0..@min(@intFromEnum(l) +| 1, non_empty_buffer.len)]; }