pub struct Decoder<'a> { /* private fields */ }Expand description
SIMPLE-TLV decoder.
Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
Sourcepub fn decode<T: Decodable<'a>>(&mut self) -> Result<T>
pub fn decode<T: Decodable<'a>>(&mut self) -> Result<T>
Decode a value which impls the Decodable trait.
Sourcepub fn decode_tagged_value<V: Decodable<'a>>(&mut self, tag: Tag) -> Result<V>
pub fn decode_tagged_value<V: Decodable<'a>>(&mut self, tag: Tag) -> Result<V>
Decode a TaggedValue with tag checked to be as expected, returning the value
Sourcepub fn decode_tagged_slice(&mut self, tag: Tag) -> Result<&'a [u8]>
pub fn decode_tagged_slice(&mut self, tag: Tag) -> Result<&'a [u8]>
Decode a TaggedSlice with tag checked to be as expected, returning the value
Sourcepub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>
pub fn error<T>(&mut self, kind: ErrorKind) -> Result<T>
Return an error with the given ErrorKind, annotating it with
context about where the error occurred.
Sourcepub fn finish<T>(self, value: T) -> Result<T>
pub fn finish<T>(self, value: T) -> Result<T>
Finish decoding, returning the given value if there is no remaining data, or an error otherwise
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
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§
Auto Trait Implementations§
impl<'a> Freeze for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more