pub struct Decoder<'a> { /* private fields */ }Expand description
DER decoder.
Implementations
sourceimpl<'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 error(&mut self, kind: ErrorKind) -> Error
 
pub fn error(&mut self, kind: ErrorKind) -> Error
Return an error with the given ErrorKind, annotating it with
context about where the error occurred.
sourcepub fn value_error(&mut self, tag: Tag) -> Error
 
pub fn value_error(&mut self, tag: Tag) -> Error
Return an error for an invalid value with the given tag.
sourcepub fn peek_byte(&self) -> Option<u8>
 
pub fn peek_byte(&self) -> Option<u8>
Peek at the next byte in the decoder without modifying the cursor.
sourcepub fn peek_tag(&self) -> Result<Tag>
 
pub fn peek_tag(&self) -> Result<Tag>
Peek at the next byte in the decoder and attempt to decode it as a
Tag value.
Does not modify the decoder’s state.
sourcepub fn peek_header(&self) -> Result<Header>
 
pub fn peek_header(&self) -> Result<Header>
Peek forward in the decoder, attempting to decode a Header from
the data at the current position in the decoder.
Does not modify the decoder’s state.
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.
sourcepub fn any_optional(&mut self) -> Result<Option<Any<'a>>>
 
pub fn any_optional(&mut self) -> Result<Option<Any<'a>>>
Attempt to decode an OPTIONAL ASN.1 ANY value.
sourcepub fn bit_string(&mut self) -> Result<BitString<'a>>
 
pub fn bit_string(&mut self) -> Result<BitString<'a>>
Attempt to decode an ASN.1 BIT STRING.
sourcepub fn context_specific<T>(
    &mut self, 
    tag_number: TagNumber, 
    tag_mode: TagMode
) -> Result<Option<T>> where
    T: DecodeValue<'a> + FixedTag, 
 
pub fn context_specific<T>(
    &mut self, 
    tag_number: TagNumber, 
    tag_mode: TagMode
) -> Result<Option<T>> where
    T: DecodeValue<'a> + FixedTag, 
Attempt to decode an ASN.1 CONTEXT-SPECIFIC field with the
provided TagNumber.
sourcepub fn generalized_time(&mut self) -> Result<GeneralizedTime>
 
pub fn generalized_time(&mut self) -> Result<GeneralizedTime>
Attempt to decode an ASN.1 GeneralizedTime.
sourcepub fn ia5_string(&mut self) -> Result<Ia5String<'a>>
 
pub fn ia5_string(&mut self) -> Result<Ia5String<'a>>
Attempt to decode an ASN.1 IA5String.
sourcepub fn octet_string(&mut self) -> Result<OctetString<'a>>
 
pub fn octet_string(&mut self) -> Result<OctetString<'a>>
Attempt to decode an ASN.1 OCTET STRING.
sourcepub fn oid(&mut self) -> Result<ObjectIdentifier>
 
pub fn oid(&mut self) -> Result<ObjectIdentifier>
Attempt to decode an ASN.1 OBJECT IDENTIFIER.
sourcepub fn optional<T: Choice<'a>>(&mut self) -> Result<Option<T>>
 
pub fn optional<T: Choice<'a>>(&mut self) -> Result<Option<T>>
Attempt to decode an ASN.1 OPTIONAL value.
sourcepub fn printable_string(&mut self) -> Result<PrintableString<'a>>
 
pub fn printable_string(&mut self) -> Result<PrintableString<'a>>
Attempt to decode an ASN.1 PrintableString.
sourcepub fn utf8_string(&mut self) -> Result<Utf8String<'a>>
 
pub fn utf8_string(&mut self) -> Result<Utf8String<'a>>
Attempt to decode an ASN.1 UTF8String.
Trait Implementations
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more