pub trait EncoderExt {
// Required methods
fn preallocate<T>(&mut self, len: usize) -> Preallocated<'_, Self, T>;
fn encode_next_iter<W, T>(
&mut self,
values: impl ExactSizeIterator<Item = T>,
) -> Result<(), EncodeError>
where W: Wire<Constraint = ()>,
T: Encode<W, Self>;
fn encode_next_iter_with_constraint<W, T>(
&mut self,
values: impl ExactSizeIterator<Item = T>,
constraint: W::Constraint,
) -> Result<(), EncodeError>
where W: Wire,
T: Encode<W, Self>;
fn encode_next<W, T>(&mut self, value: T) -> Result<(), EncodeError>
where W: Wire<Constraint = ()>,
T: Encode<W, Self>;
fn encode_next_with_constraint<W: Wire, T: Encode<W, Self>>(
&mut self,
value: T,
constraint: W::Constraint,
) -> Result<(), EncodeError>;
fn encode<W, T>(value: T) -> Result<Self, EncodeError>
where Self: Default,
W: Wire<Constraint = ()>,
T: Encode<W, Self>;
fn encode_with_constraint<W, T>(
value: T,
constraint: W::Constraint,
) -> Result<Self, EncodeError>
where Self: Default,
W: Wire,
T: Encode<W, Self>;
}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<W, T>(
&mut self,
values: impl ExactSizeIterator<Item = T>,
) -> Result<(), EncodeError>
fn encode_next_iter<W, T>( &mut self, values: impl ExactSizeIterator<Item = T>, ) -> Result<(), EncodeError>
Encodes an iterator of elements.
Returns Err if encoding failed.
Sourcefn encode_next_iter_with_constraint<W, T>(
&mut self,
values: impl ExactSizeIterator<Item = T>,
constraint: W::Constraint,
) -> Result<(), EncodeError>
fn encode_next_iter_with_constraint<W, T>( &mut self, values: impl ExactSizeIterator<Item = T>, constraint: W::Constraint, ) -> Result<(), EncodeError>
Encodes an iterator of elements.
Returns Err if encoding failed.
Sourcefn encode_next<W, T>(&mut self, value: T) -> Result<(), EncodeError>
fn encode_next<W, T>(&mut self, value: T) -> Result<(), EncodeError>
Encodes a value.
Returns Err if encoding failed.
Sourcefn encode_next_with_constraint<W: Wire, T: Encode<W, Self>>(
&mut self,
value: T,
constraint: W::Constraint,
) -> Result<(), EncodeError>
fn encode_next_with_constraint<W: Wire, T: Encode<W, Self>>( &mut self, value: T, constraint: W::Constraint, ) -> Result<(), EncodeError>
Encodes a value with a constraint.
Returns Err if encoding failed.
Sourcefn encode<W, T>(value: T) -> Result<Self, EncodeError>
fn encode<W, T>(value: T) -> Result<Self, EncodeError>
Encodes a value into a new instance of the encoder.
Returns Err if encoding failed.
Sourcefn encode_with_constraint<W, T>(
value: T,
constraint: W::Constraint,
) -> Result<Self, EncodeError>
fn encode_with_constraint<W, T>( value: T, constraint: W::Constraint, ) -> Result<Self, EncodeError>
Encodes a value with a constraint into a new instance of the encoder.
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.