Trait EncoderExt

Source
pub trait EncoderExt {
    // Required methods
    fn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>;
    fn encode_next_iter<T: Encode<Self>>(
        &mut self,
        values: impl ExactSizeIterator<Item = T>,
    ) -> Result<(), EncodeError>;
    fn encode_next<T: Encode<Self>>(
        &mut self,
        value: T,
    ) -> Result<(), EncodeError>;
}
Expand description

Extension methods for Encoder.

Required Methods§

Source

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

Pre-allocates space for a slice of elements.

Source

fn encode_next_iter<T: Encode<Self>>( &mut self, values: impl ExactSizeIterator<Item = T>, ) -> Result<(), EncodeError>

Encodes an iterator of elements.

Returns Err if encoding failed.

Source

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

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§

Source§

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