Struct bytecodec::combinator::MapErr
[−]
[src]
pub struct MapErr<C, F, E> { /* fields omitted */ }
Combinator for modifying encoding/decoding errors.
This is created by calling {DecodeExt, EncodeExt}::map_err
method.
Trait Implementations
impl<C: Debug, F: Debug, E: Debug> Debug for MapErr<C, F, E>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<D, F, E> Decode for MapErr<D, F, E> where
D: Decode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
D: Decode,
F: Fn(Error) -> E,
Error: From<E>,
type Item = D::Item
The type of items to be decoded.
fn decode(
&mut self,
buf: &[u8],
eos: Eos
) -> Result<(usize, Option<Self::Item>)>
[src]
&mut self,
buf: &[u8],
eos: Eos
) -> Result<(usize, Option<Self::Item>)>
Consumes the given buffer (a part of a byte sequence), and decodes an item from it. Read more
fn is_idle(&self) -> bool
[src]
Returns true
if there is no item being decoded by the decoder, otherwise false
.
fn requiring_bytes(&self) -> ByteCount
[src]
Returns the lower bound of the number of bytes needed to decode the next item. Read more
impl<C, F, E> Encode for MapErr<C, F, E> where
C: Encode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
C: Encode,
F: Fn(Error) -> E,
Error: From<E>,
type Item = C::Item
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<C, F, E> ExactBytesEncode for MapErr<C, F, E> where
C: ExactBytesEncode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
C: ExactBytesEncode,
F: Fn(Error) -> E,
Error: From<E>,
fn exact_requiring_bytes(&self) -> u64
[src]
Returns the exact number of bytes required to encode all the items remaining in the encoder.