Struct bytecodec::combinator::MapErr [−][src]
pub struct MapErr<C, E, F> { /* fields omitted */ }
Combinator for modifying encoding/decoding errors.
This is created by calling {DecodeExt, EncodeExt}::map_err
method.
Methods
impl<C, E, F> MapErr<C, E, F>
[src]
impl<C, E, F> MapErr<C, E, F>
ⓘImportant traits for &'a mut Rpub fn inner_ref(&self) -> &C
[src]
pub fn inner_ref(&self) -> &C
Returns a reference to the inner encoder or decoder.
ⓘImportant traits for &'a mut Rpub fn inner_mut(&mut self) -> &mut C
[src]
pub fn inner_mut(&mut self) -> &mut C
Returns a mutable reference to the inner encoder or decoder.
pub fn into_inner(self) -> C
[src]
pub fn into_inner(self) -> C
Takes ownership of this instance and returns the inner encoder or decoder.
Trait Implementations
impl<C: Debug, E: Debug, F: Debug> Debug for MapErr<C, E, F>
[src]
impl<C: Debug, E: Debug, F: Debug> Debug for MapErr<C, E, F>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<D, E, F> Decode for MapErr<D, E, F> where
D: Decode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
impl<D, E, F> Decode for MapErr<D, E, F> where
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>
[src]
fn decode(&mut self, buf: &[u8], eos: Eos) -> Result<usize>
Consumes the given buffer (a part of a byte sequence), and proceeds the decoding process. Read more
fn finish_decoding(&mut self) -> Result<Self::Item>
[src]
fn finish_decoding(&mut self) -> Result<Self::Item>
Finishes the current decoding process and returns the decoded item. Read more
fn requiring_bytes(&self) -> ByteCount
[src]
fn requiring_bytes(&self) -> ByteCount
Returns the lower bound of the number of bytes needed to decode the next item. Read more
fn is_idle(&self) -> bool
[src]
fn is_idle(&self) -> bool
Returns true
if there are no items to be decoded by the decoder at the next invocation of decode
method, otherwise false
. Read more
impl<C, E, F> Encode for MapErr<C, E, F> where
C: Encode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
impl<C, E, F> Encode for MapErr<C, E, F> where
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]
fn encode(&mut self, buf: &mut [u8], eos: Eos) -> Result<usize>
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]
fn start_encoding(&mut self, item: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
fn requiring_bytes(&self) -> ByteCount
[src]
fn requiring_bytes(&self) -> ByteCount
Returns the number of bytes required to encode all the items in the encoder. Read more
fn is_idle(&self) -> bool
[src]
fn is_idle(&self) -> bool
Returns true
if there are no items to be encoded in the encoder, otherwise false
. Read more
impl<C, E, F> SizedEncode for MapErr<C, E, F> where
C: SizedEncode,
F: Fn(Error) -> E,
Error: From<E>,
[src]
impl<C, E, F> SizedEncode for MapErr<C, E, F> where
C: SizedEncode,
F: Fn(Error) -> E,
Error: From<E>,
fn exact_requiring_bytes(&self) -> u64
[src]
fn exact_requiring_bytes(&self) -> u64
Returns the exact number of bytes required to encode all the items remaining in the encoder.