Trait EncoderForExt

Source
pub trait EncoderForExt {
    // Provided methods
    fn to_vec<F>(&self) -> Vec<u8> 
       where F: 'static,
             Self: EncoderFor<F> { ... }
    fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>
       where F: 'static,
             Self: EncoderFor<F> { ... }
    fn encode_buffer_uninit<'a, F>(
        &self,
        buf: &'a mut [MaybeUninit<u8>],
    ) -> Result<&'a mut [u8], usize>
       where F: 'static,
             Self: EncoderFor<F> { ... }
    fn measure<F>(&self) -> usize
       where F: 'static,
             Self: EncoderFor<F> { ... }
}
Expand description

Helper trait for encodable objects.

Provided Methods§

Source

fn to_vec<F>(&self) -> Vec<u8>
where F: 'static, Self: EncoderFor<F>,

Convert this builder into a vector of bytes. This is generally not the most efficient way to perform serialization.

Source

fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>
where F: 'static, Self: EncoderFor<F>,

Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.

Source

fn encode_buffer_uninit<'a, F>( &self, buf: &'a mut [MaybeUninit<u8>], ) -> Result<&'a mut [u8], usize>
where F: 'static, Self: EncoderFor<F>,

Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.

Source

fn measure<F>(&self) -> usize
where F: 'static, Self: EncoderFor<F>,

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.

Implementors§

Source§

impl<T> EncoderForExt for T
where T: ?Sized,