pub trait Encoder {
// Required method
fn encode<T>(&self, value: &T) -> Result<Bytes, EncodeError>
where T: Serialize;
// Provided methods
fn encode_mut<T>(&mut self, value: &T) -> Result<Bytes, EncodeError>
where T: Serialize { ... }
fn transform<BT>(self, transformer: BT) -> TransformedEncoder<Self, BT>
where Self: Sized,
BT: BinaryTransform { ... }
}Expand description
An encoder that can transform a serde-serializable object into binary data.
Required Methods§
Provided Methods§
Sourcefn encode_mut<T>(&mut self, value: &T) -> Result<Bytes, EncodeError>where
T: Serialize,
fn encode_mut<T>(&mut self, value: &T) -> Result<Bytes, EncodeError>where
T: Serialize,
Encode the specified object and return the bytes representing the encoded value, possibly mutating the state of the encoder.
Sourcefn transform<BT>(self, transformer: BT) -> TransformedEncoder<Self, BT>where
Self: Sized,
BT: BinaryTransform,
fn transform<BT>(self, transformer: BT) -> TransformedEncoder<Self, BT>where
Self: Sized,
BT: BinaryTransform,
Takes the encoder and applies the given transform to data produced by it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.