logo

Struct der::Decoder

source · []
pub struct Decoder<'a> { /* private fields */ }
Expand description

DER decoder.

Implementations

Create a new decoder for the given byte slice.

Decode a value which impls the Decodable trait.

Return an error with the given ErrorKind, annotating it with context about where the error occurred.

Return an error for an invalid value with the given tag.

Did the decoding operation fail due to an error?

Get the position within the buffer.

Peek at the next byte in the decoder without modifying the cursor.

Peek at the next byte in the decoder and attempt to decode it as a Tag value.

Does not modify the decoder’s state.

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.

Finish decoding, returning the given value if there is no remaining data, or an error otherwise

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.

Attempt to decode an ASN.1 ANY value.

Attempt to decode an OPTIONAL ASN.1 ANY value.

Attempt to decode ASN.1 INTEGER as i8

Attempt to decode ASN.1 INTEGER as i16

Attempt to decode unsigned ASN.1 INTEGER as u8

Attempt to decode unsigned ASN.1 INTEGER as u16

Attempt to decode an ASN.1 BIT STRING.

Attempt to decode an ASN.1 CONTEXT-SPECIFIC field with the provided TagNumber.

Attempt to decode an ASN.1 GeneralizedTime.

Attempt to decode an ASN.1 IA5String.

Attempt to decode an ASN.1 NULL value.

Attempt to decode an ASN.1 OCTET STRING.

This is supported on crate feature oid only.

Attempt to decode an ASN.1 OBJECT IDENTIFIER.

Attempt to decode an ASN.1 OPTIONAL value.

Attempt to decode an ASN.1 PrintableString.

Attempt to decode an ASN.1 UTCTime.

Attempt to decode an ASN.1 UTF8String.

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

Obtain a slice of bytes contain a complete TLV production suitable for parsing later.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.