Trait EncoderExt

pub trait EncoderExt {
    // Required methods
    fn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>;
    fn encode_next_slice<T>(
        &mut self,
        values: &mut [T],
    ) -> Result<(), EncodeError>
       where T: Encode<Self>;
    fn encode_next<T>(&mut self, value: &mut T) -> Result<(), EncodeError>
       where T: Encode<Self>;
}
Expand description

Extension methods for Encoder.

Required Methods§

fn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>

Pre-allocates space for a slice of elements.

fn encode_next_slice<T>(&mut self, values: &mut [T]) -> Result<(), EncodeError>
where T: Encode<Self>,

Encodes a slice of elements.

Returns Err if encoding failed.

fn encode_next<T>(&mut self, value: &mut T) -> Result<(), EncodeError>
where T: Encode<Self>,

Encodes a value.

Returns Err if encoding failed.

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§

§

impl<E> EncoderExt for E
where E: Encoder + ?Sized,