pub trait Encode {
// Required methods
fn encode_by_ref<A>(
&self,
buf: &mut BytesMut,
encoder: &mut A,
) -> Result<(), <A as Encoder>::Error>
where A: Encoder;
fn bytes_count(&self) -> usize;
// Provided method
fn encode<A>(
self,
buf: &mut BytesMut,
encoder: &mut A,
) -> Result<(), <A as Encoder>::Error>
where A: Encoder,
Self: Sized { ... }
}
Required Methods§
Sourcefn encode_by_ref<A>(
&self,
buf: &mut BytesMut,
encoder: &mut A,
) -> Result<(), <A as Encoder>::Error>where
A: Encoder,
fn encode_by_ref<A>(
&self,
buf: &mut BytesMut,
encoder: &mut A,
) -> Result<(), <A as Encoder>::Error>where
A: Encoder,
encode by references
Sourcefn bytes_count(&self) -> usize
fn bytes_count(&self) -> usize
be careful to calculate the number of bytes
Provided Methods§
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.