[−][src]Struct simple_tlv::Decoder
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,