Function splatByte [src]
Writes the same byte many times, allowing short writes.
Does maximum of one underlying VTable.drain.
Prototype
pub fn splatByte(w: *Writer, byte: u8, n: usize) Error!usize
Parameters
w: *Writer
byte: u8
n: usize
Possible Errors
See the Writer
implementation for detailed diagnostics.
Source
pub fn splatByte(w: *Writer, byte: u8, n: usize) Error!usize {
if (w.end + n <= w.buffer.len) {
@branchHint(.likely);
@memset(w.buffer[w.end..][0..n], byte);
w.end += n;
return n;
}
return writeSplat(w, &.{&.{byte}}, n);
}