Trait Encoder Copy item path Source pub trait Encoder {
type Error ;
// Required methods
fn put_slice (&mut self, slice: &[u8 ]) -> Result <() , Self::Error >;
fn put_byte (&mut self, byte: u8 ) -> Result <() , Self::Error >;
}Expand description A type that can handle an Encodable type
An encoder is responsible for writing bytes into a buffer or other
destination. Encoders are used by encodables to write their data. Thus,
encoders must uphold the same properties as encodables.
The error type that can be returned when encoding a value.
For example, some encoders may return an error if the underlying buffer
is full
Copies a slice of bytes into the encoder
§ Errors
Implementations of this method should return an error if the underlying
encoder fails to write the slice of bytes.
Appends a single byte into the encoder, if possible.
§ Errors
Implementations of this method should return an error if the underlying
encoder fails to write the byte.