pub trait Encodable<E>where
E: Encoder,{
type Error: From<E::Error>;
// Required method
fn encode(&self, encoder: &mut E) -> Result<(), Self::Error>;
}Expand description
A type that can be encoded into an encoder.
An encoder must be pure, meaning that it has to uphold the following properties:
- It must have no side effects
- It must produce the same outputs for the same inputs
Some examples of non-indepotent encodes are:
- Writing to a file or other I/O device
- Using random number generators
- Panics
- Using global state