pub struct Decoder<'a> { /* private fields */ }Expand description
BER-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<T: Decodable<'a> + TagLike, V: Decodable<'a>>(
&mut self,
tag: T
) -> Result<V>
pub fn decode_tagged_value<T: Decodable<'a> + TagLike, V: Decodable<'a>>(
&mut self,
tag: T
) -> Result<V>
Decode a TaggedValue with tag checked to be as expected, returning the value
sourcepub fn decode_tagged_slice<T: Decodable<'a> + TagLike>(
&mut self,
tag: T
) -> Result<&'a [u8]>
pub fn decode_tagged_slice<T: Decodable<'a> + TagLike>(
&mut self,
tag: T
) -> 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.