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§
Sourcefn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>
fn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>
Pre-allocates space for a slice of elements.
Sourcefn encode_next_iter<T: Encode<Self>>(
&mut self,
values: impl ExactSizeIterator<Item = T>,
) -> Result<(), EncodeError>
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.
Sourcefn encode_next<T: Encode<Self>>(&mut self, value: T) -> Result<(), EncodeError>
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.