forall Self.
trait Writer {
/// Writes one byte.
fn write_byte(self: Self, byte: u8) -> Self;
/// Writes the bytes of `'static` text, such as a literal.
fn write_static(self: Self, bytes: Str['static]) -> Self;
/// Writes `len` bytes starting at `ptr`; the writer reads them before it
/// returns and keeps no pointer to them. Caller: `ptr[0..len)` is
/// readable for the whole call.
unsafe fn write_raw(self: Self, ptr: *u8, len: usize) -> Self;
}
A destination for bytes: the output protocol that f-strings and Format write to.
Methods
method write_bytesource
fn write_byte(self: Self, byte: u8) -> Self;
Writes one byte.
method write_staticsource
fn write_static(self: Self, bytes: Str['static]) -> Self;
Writes the bytes of 'static text, such as a literal.
method write_rawsource
unsafe fn write_raw(self: Self, ptr: *u8, len: usize) -> Self;
Writes len bytes starting at ptr; the writer reads them before it returns and keeps no pointer to them. Caller: ptr[0..len) is readable for the whole call.
Implementors
instance Writer[Output!]source
instance Writer[Output!] { ... }
In std::io.
Output as a writer: bytes gather and are written 4 KiB at a time.
instance Writer[ReadingWriter![W, C]]source
forall W, C where Writer[W].
instance Writer[ReadingWriter![W, C]] { ... }
In core::fmt.
Every write goes to the inner writer.
instance Writer[CountingWriter]source
instance Writer[CountingWriter] { ... }
In core::fmt.
Each write adds its length to the count.
instance Writer[Buffer!]source
instance Writer[Buffer!] { ... }
In alloc::buffer.
A buffer as a writer: every write appends, growing first if needed.
Infallible: Buffer! aborts on out-of-memory.
instance Writer[FixedWriter!]source
instance Writer[FixedWriter!] { ... }
In alloc::fmt.
A fixed writer as a writer: bytes past its capacity are dropped.