pub trait EncoderValue: Sized {
// Required method
fn encode<E: Encoder>(&self, encoder: &mut E);
// Provided methods
fn encode_mut<E: Encoder>(&mut self, encoder: &mut E) { ... }
fn encoding_size(&self) -> usize { ... }
fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize { ... }
fn encode_with_len_prefix<Len: TryFrom<usize> + EncoderValue, E: Encoder>(
&self,
encoder: &mut E,
)
where Self: Sized,
Len::Error: Debug { ... }
fn encode_to_vec(&self) -> Vec<u8> ⓘ { ... }
}
Required Methods§
Provided Methods§
Sourcefn encode_mut<E: Encoder>(&mut self, encoder: &mut E)
fn encode_mut<E: Encoder>(&mut self, encoder: &mut E)
Encodes the value into the encoder, while potentially mutating the value itself
Sourcefn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
Sourcefn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize
fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize
Returns the encoding size for the given encoder’s capacity
Sourcefn encode_with_len_prefix<Len: TryFrom<usize> + EncoderValue, E: Encoder>(
&self,
encoder: &mut E,
)
fn encode_with_len_prefix<Len: TryFrom<usize> + EncoderValue, E: Encoder>( &self, encoder: &mut E, )
Encodes the value into the encoder with a prefix of Len
fn encode_to_vec(&self) -> Vec<u8> ⓘ
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.
Implementations on Foreign Types§
Source§impl EncoderValue for &Bytes
Available on crate feature bytes
only.
impl EncoderValue for &Bytes
Available on crate feature
bytes
only.Source§impl EncoderValue for &[&[u8]]
impl EncoderValue for &[&[u8]]
Source§impl EncoderValue for &[u8]
impl EncoderValue for &[u8]
Source§impl EncoderValue for &mut [u8]
impl EncoderValue for &mut [u8]
Source§impl EncoderValue for f32
impl EncoderValue for f32
Source§impl EncoderValue for f64
impl EncoderValue for f64
Source§impl EncoderValue for i8
impl EncoderValue for i8
Source§impl EncoderValue for i16
impl EncoderValue for i16
Source§impl EncoderValue for i32
impl EncoderValue for i32
Source§impl EncoderValue for i64
impl EncoderValue for i64
Source§impl EncoderValue for i128
impl EncoderValue for i128
Source§impl EncoderValue for u8
impl EncoderValue for u8
Source§impl EncoderValue for u16
impl EncoderValue for u16
Source§impl EncoderValue for u32
impl EncoderValue for u32
Source§impl EncoderValue for u64
impl EncoderValue for u64
Source§impl EncoderValue for u128
impl EncoderValue for u128
Source§impl EncoderValue for ()
impl EncoderValue for ()
Source§impl EncoderValue for Bytes
Available on crate feature bytes
only.
impl EncoderValue for Bytes
Available on crate feature
bytes
only.