Skip to main content

EncoderValue

Trait EncoderValue 

Source
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§

Source

fn encode<E: Encoder>(&self, encoder: &mut E)

Encodes the value into the encoder

Provided Methods§

Source

fn encode_mut<E: Encoder>(&mut self, encoder: &mut E)

Encodes the value into the encoder, while potentially mutating the value itself

Source

fn encoding_size(&self) -> usize

Returns the encoding size with no buffer constrains

Source

fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize

Returns the encoding size for the given encoder’s capacity

Source

fn encode_with_len_prefix<Len: TryFrom<usize> + EncoderValue, E: Encoder>( &self, encoder: &mut E, )
where Self: Sized, Len::Error: Debug,

Encodes the value into the encoder with a prefix of Len

Source

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".

Implementations on Foreign Types§

Source§

impl EncoderValue for &Bytes

Available on crate feature bytes only.
Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for &[&[u8]]

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for &[u8]

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for &mut [u8]

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for f32

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for f64

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for i8

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for i16

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for i32

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for i64

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for i128

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for u8

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for u16

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for u32

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for u64

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for u128

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for ()

Source§

fn encode<E: Encoder>(&self, _encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl EncoderValue for Bytes

Available on crate feature bytes only.
Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, _encoder: &E) -> usize

Source§

impl<A: EncoderValue, B: EncoderValue> EncoderValue for (A, B)

Source§

fn encode<E: Encoder>(&self, encoder: &mut E)

Source§

fn encoding_size(&self) -> usize

Source§

fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize

Source§

impl<T: EncoderValue> EncoderValue for Option<T>

Source§

fn encode<E: Encoder>(&self, buffer: &mut E)

Source§

fn encode_mut<E: Encoder>(&mut self, buffer: &mut E)

Implementors§

Source§

impl EncoderValue for DecoderBuffer<'_>

Source§

impl EncoderValue for DecoderBufferMut<'_>

Source§

impl EncoderValue for i24

Source§

impl EncoderValue for i48

Source§

impl EncoderValue for u24

Source§

impl EncoderValue for u48

Source§

impl EncoderValue for I16
where I16: IntoBytes,

Source§

impl EncoderValue for I32
where I32: IntoBytes,

Source§

impl EncoderValue for I64
where I64: IntoBytes,

Source§

impl EncoderValue for I128
where I128: IntoBytes,

Source§

impl EncoderValue for U16
where U16: IntoBytes,

Source§

impl EncoderValue for U32
where U32: IntoBytes,

Source§

impl EncoderValue for U64
where U64: IntoBytes,

Source§

impl EncoderValue for U128
where U128: IntoBytes,

Source§

impl<'a> EncoderValue for &'a I16
where I16: IntoBytes,

Source§

impl<'a> EncoderValue for &'a I32
where I32: IntoBytes,

Source§

impl<'a> EncoderValue for &'a I64
where I64: IntoBytes,

Source§

impl<'a> EncoderValue for &'a I128
where I128: IntoBytes,

Source§

impl<'a> EncoderValue for &'a U16
where U16: IntoBytes,

Source§

impl<'a> EncoderValue for &'a U32
where U32: IntoBytes,

Source§

impl<'a> EncoderValue for &'a U64
where U64: IntoBytes,

Source§

impl<'a> EncoderValue for &'a U128
where U128: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut I16
where I16: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut I32
where I32: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut I64
where I64: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut I128
where I128: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut U16
where U16: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut U32
where U32: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut U64
where U64: IntoBytes,

Source§

impl<'a> EncoderValue for &'a mut U128
where U128: IntoBytes,