pub fn write(w: *Writer, bytes: []const u8) Error!usize
Transfers bytes to the stream, calling drain at most once.
bytes
drain
Returns the number of bytes transferred, which may be less than bytes.len, including zero.
bytes.len
A return value less than bytes.len does not indicate failure; a subsequent call may return nonzero, or fail with error.WriteFailed.
error.WriteFailed
See also:
writeAll
writeVec
w: *Writer
bytes: []const u8
WriteFailed
See the Writer implementation for detailed diagnostics.
Writer
608 609 610 611 612 613 614 615 616
pub fn write(w: *Writer, bytes: []const u8) Error!usize { if (w.end + bytes.len <= w.buffer.len) { @branchHint(.likely); @memcpy(w.buffer[w.end..][0..bytes.len], bytes); w.end += bytes.len; return bytes.len; } return w.vtable.drain(w, &.{bytes}, 1); }
Transfers
bytesto the stream, callingdrainat most once.Returns the number of bytes transferred, which may be less than
bytes.len, including zero.A return value less than
bytes.lendoes not indicate failure; a subsequent call may return nonzero, or fail witherror.WriteFailed.See also:
writeAllwriteVec