[][src]Struct der::Decoder

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

DER 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 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.

pub fn any(&mut self) -> Result<Any<'a>>[src]

Attempt to decode an ASN.1 ANY value.

pub fn bit_string(&mut self) -> Result<BitString<'a>>[src]

Attempt to decode an ASN.1 BIT STRING.

pub fn null(&mut self) -> Result<Null>[src]

Attempt to decode an ASN.1 NULL value.

pub fn octet_string(&mut self) -> Result<OctetString<'a>>[src]

Attempt to decode an ASN.1 OCTET STRING.

pub fn oid(&mut self) -> Result<ObjectIdentifier>[src]

This is supported on crate feature oid only.

Attempt to decode an ASN.1 OBJECT IDENTIFIER.

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

Attempt to decode an ASN.1 OPTIONAL value.

pub fn sequence<F, T>(&mut self, f: F) -> Result<T> where
    F: FnOnce(&mut Decoder<'a>) -> Result<T>, 
[src]

Attempt to decode an ASN.1 SEQUENCE, creating a new nested Decoder and calling the provided argument with it.

Trait Implementations

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

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

Auto Trait Implementations

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

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

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

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

impl<'a> UnwindSafe 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.