Trait TaggedDecode

Source
pub trait TaggedDecode: Decode {
    type Tag;

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

This trait allows for decoding 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 start_decoding(&mut self, tag: Self::Tag) -> Result<()>

Prepares to start decoding an item tagged by tag.

§Errors

The following errors may be returned by the decoder:

  • ErrorKind::InvalidInput:
    • Unexpected tag was passed
  • 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 + TaggedDecode> TaggedDecode for &mut D

Source§

type Tag = <D as TaggedDecode>::Tag

Source§

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

Source§

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

Source§

type Tag = <D as TaggedDecode>::Tag

Source§

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

Implementors§