Struct bytecodec::combinator::MapFrom
[−]
[src]
pub struct MapFrom<E, T, F> { /* fields omitted */ }
Combinator for converting items into ones that suited to the inner encoder by calling the given function.
This is created by calling EncodeExt::map_from
method.
Trait Implementations
impl<E: Debug, T: Debug, F: Debug> Debug for MapFrom<E, T, F>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<E, T, F> Encode for MapFrom<E, T, F> where
E: Encode,
F: Fn(T) -> E::Item,
[src]
E: Encode,
F: Fn(T) -> E::Item,
type Item = T
The type of items to be encoded.
fn encode(&mut self, buf: &mut [u8], eos: Eos) -> Result<usize>
[src]
Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more
fn start_encoding(&mut self, item: Self::Item) -> Result<()>
[src]
Tries to start encoding the given item. Read more
fn requiring_bytes(&self) -> ByteCount
[src]
Returns the number of bytes required to encode all the items in the encoder. Read more
fn is_idle(&self) -> bool
[src]
Returns true
if there are no items to be encoded in the encoder, otherwise false
.
impl<E, T, F> ExactBytesEncode for MapFrom<E, T, F> where
E: ExactBytesEncode,
F: Fn(T) -> E::Item,
[src]
E: ExactBytesEncode,
F: Fn(T) -> E::Item,
fn exact_requiring_bytes(&self) -> u64
[src]
Returns the exact number of bytes required to encode all the items remaining in the encoder.