Function writableSlicePreserve [src]

Asserts the provided buffer has total capacity enough for len. Advances the buffer end position by len. When draining the buffer, ensures that at least preserve bytes remain buffered. If preserve is zero, this is equivalent to writableSlice.

Prototype

pub fn writableSlicePreserve(w: *Writer, preserve: usize, len: usize) Error![]u8

Parameters

w: *Writerpreserve: usizelen: usize

Possible Errors

WriteFailed

See the Writer implementation for detailed diagnostics.

Source

pub fn writableSlicePreserve(w: *Writer, preserve: usize, len: usize) Error![]u8 { const big_slice = try w.writableSliceGreedyPreserve(preserve, len); advance(w, len); return big_slice[0..len]; }