DoxigAlpha

slice1

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.

Function parameters

Parameters

#
non_empty_buffer:[]u8

Type definitions in this namespace

Types

#
AnyReader
Deprecated in favor of `Reader`.
AnyWriter
Deprecated in favor of `Writer`.

Deprecated in favor of `Reader`.

Functions

#
GenericReader
Deprecated in favor of `Reader`.
GenericWriter
Deprecated in favor of `Writer`.
FixedBufferStream
Deprecated in favor of `Reader`.
fixedBufferStream
Deprecated in favor of `Reader`.
CountingReader
Deprecated with no replacement; inefficient pattern
countingReader
Deprecated with no replacement; inefficient pattern
PollFiles
Given an enum, returns a struct with fields of that enum, each field

Deprecated in favor of `Writer.Discarding`.

Values

#
null_writer
Deprecated in favor of `Writer.Discarding`.

Source

Implementation

#
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)];
}