[][src]Struct simple_tlv::Decoder

pub struct Decoder<'a> { /* fields omitted */ }

SIMPLE-TLV decoder.

Implementations

impl<'a> Decoder<'a>[src]

pub fn new(bytes: &'a [u8]) -> Self[src]

Create a new decoder for the given byte slice.

pub fn decode<T: Decodable<'a>>(&mut self) -> Result<T>[src]

Decode a value which impls the Decodable trait.

pub fn decode_tagged_value<V: Decodable<'a>>(&mut self, tag: Tag) -> Result<V>[src]

Decode a TaggedValue with tag checked to be as expected, returning the value

pub fn decode_tagged_slice(&mut self, tag: Tag) -> Result<&'a [u8]>[src]

Decode a TaggedSlice with tag checked to be as expected, returning the value

pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>[src]

Return an error with the given ErrorKind, annotating it with context about where the error occurred.

pub fn is_failed(&self) -> bool[src]

Did the decoding operation fail due to an error?

pub fn finish<T>(self, value: T) -> Result<T>[src]

Finish decoding, returning the given value if there is no remaining data, or an error otherwise

pub fn is_finished(&self) -> bool[src]

Have we decoded all of the bytes in this Decoder?

Returns false if we're not finished decoding or if a fatal error has occurred.

Trait Implementations

impl<'a> Debug for Decoder<'a>[src]

impl<'a> From<&'a [u8]> for Decoder<'a>[src]

Auto Trait Implementations

impl<'a> Send for Decoder<'a>[src]

impl<'a> Sync for Decoder<'a>[src]

impl<'a> Unpin for Decoder<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.