Trait encoding::types::ByteWriter
[−]
[src]
pub trait ByteWriter { fn write_byte(&mut self, b: u8); fn write_bytes(&mut self, v: &[u8]); fn writer_hint(&mut self, _expectedlen: usize) { ... } }
Byte writer used by encoders. In most cases this will be an owned vector of u8
.
Required Methods
fn write_byte(&mut self, b: u8)
Writes a single byte.
fn write_bytes(&mut self, v: &[u8])
Writes a number of bytes.
Provided Methods
fn writer_hint(&mut self, _expectedlen: usize)
Hints an expected lower bound on the length (in bytes) of the output
until the next call to writer_hint
,
so that the writer can reserve the memory for writing.
RawEncoder
s are recommended but not required to call this method
with an appropriate estimate.
By default this method does nothing.
Implementors
impl ByteWriter for Vec<u8>