Function writeByte [src]
Calls drain as many times as necessary such that byte is transferred.
Prototype
pub fn writeByte(w: *Writer, byte: u8) Error!void
Parameters
w: *Writer
byte: u8
Possible Errors
See the Writer
implementation for detailed diagnostics.
Source
pub fn writeByte(w: *Writer, byte: u8) Error!void {
while (w.buffer.len - w.end == 0) {
const n = try w.vtable.drain(w, &.{&.{byte}}, 1);
if (n > 0) return;
} else {
@branchHint(.likely);
w.buffer[w.end] = byte;
w.end += 1;
}
}