TryTaggedDecode

Trait TryTaggedDecode 

Source
pub trait TryTaggedDecode: Decode {
    type Tag;

    // Required method
    fn try_start_decoding(&mut self, tag: Self::Tag) -> Result<bool>;
}
Expand description

This trait allows for decoding known-tagged or unknown-tagged items from a byte sequence incrementally.

Required Associated Types§

Source

type Tag

The type of tags prefixed to the items to be decoded.

Required Methods§

Source

fn try_start_decoding(&mut self, tag: Self::Tag) -> Result<bool>

Tries to prepare to start decoding an item tagged by tag.

If the given tag is unknown, it will return Ok(false).

§Errors

The following errors may be returned by the decoder:

  • ErrorKind::IncompleteDecoding:
    • The previous decoding process has not been completed
  • ErrorKind::DecoderTerminated:
    • The decoder has terminated (i.e., cannot decode any more items)
  • ErrorKind::Other:
    • Other errors has occurred

Implementations on Foreign Types§

Source§

impl<D: ?Sized + TryTaggedDecode> TryTaggedDecode for &mut D

Source§

type Tag = <D as TryTaggedDecode>::Tag

Source§

fn try_start_decoding(&mut self, tag: Self::Tag) -> Result<bool>

Source§

impl<D: ?Sized + TryTaggedDecode> TryTaggedDecode for Box<D>

Source§

type Tag = <D as TryTaggedDecode>::Tag

Source§

fn try_start_decoding(&mut self, tag: Self::Tag) -> Result<bool>

Implementors§