Trait rasn::Decoder[][src]

pub trait Decoder: Sized {
    type Error: Error;
Show 16 methods fn decode_any(&mut self) -> Result<Any, Self::Error>;
fn decode_bit_string(&mut self, tag: Tag) -> Result<BitString, Self::Error>;
fn decode_bool(&mut self, tag: Tag) -> Result<bool, Self::Error>;
fn decode_enumerated(&mut self, tag: Tag) -> Result<Integer, Self::Error>;
fn decode_integer(&mut self, tag: Tag) -> Result<Integer, Self::Error>;
fn decode_null(&mut self, tag: Tag) -> Result<(), Self::Error>;
fn decode_object_identifier(
        &mut self,
        tag: Tag
    ) -> Result<ObjectIdentifier, Self::Error>;
fn decode_sequence<D, F>(
        &mut self,
        tag: Tag,
        decode_fn: F
    ) -> Result<D, Self::Error>
    where
        F: FnOnce(&mut Self) -> Result<D, Self::Error>
;
fn decode_sequence_of<D: Decode>(
        &mut self,
        tag: Tag
    ) -> Result<Vec<D>, Self::Error>;
fn decode_set_of<D: Decode + Ord>(
        &mut self,
        tag: Tag
    ) -> Result<SetOf<D>, Self::Error>;
fn decode_octet_string(&mut self, tag: Tag) -> Result<Vec<u8>, Self::Error>;
fn decode_utf8_string(
        &mut self,
        tag: Tag
    ) -> Result<Utf8String, Self::Error>;
fn decode_explicit_prefix<D: Decode>(
        &mut self,
        tag: Tag
    ) -> Result<D, Self::Error>;
fn decode_utc_time(&mut self, tag: Tag) -> Result<UtcTime, Self::Error>;
fn decode_generalized_time(
        &mut self,
        tag: Tag
    ) -> Result<GeneralizedTime, Self::Error>;
fn decode_set<FIELDS, SET, F>(
        &mut self,
        tag: Tag,
        decode_operation: F
    ) -> Result<SET, Self::Error>
    where
        SET: Decode,
        FIELDS: Decode,
        F: FnOnce(Vec<FIELDS>) -> Result<SET, Self::Error>
;
}
Expand description

A data format decode any ASN.1 data type.

Associated Types

Required methods

Decode a unknown ASN.1 value identified by tag from the available input.

Decode a BIT STRING identified by tag from the available input.

Decode a BOOL identified by tag from the available input.

Decode an enumerated enum’s discriminant identified by tag from the available input.

Decode a INTEGER identified by tag from the available input.

Decode NULL identified by tag from the available input.

Decode a OBJECT IDENTIFIER identified by tag from the available input.

Decode a SEQUENCE identified by tag from the available input. Returning a new Decoder containing the sequence’s contents to be decoded.

Decode a SEQUENCE OF D where D: Decode identified by tag from the available input.

Decode a SET OF D where D: Decode identified by tag from the available input.

Decode a OCTET STRING identified by tag from the available input.

Decode a UTF8 STRING identified by tag from the available input.

Decode an ASN.1 value that has been explicitly prefixed with tag from the available input.

Decode a UtcTime identified by tag from the available input.

Decode a GeneralizedTime identified by tag from the available input.

Decode a SET identified by tag from the available input. Decoding SETs works a little different than other methods, as you need to provide two types SET and SET, SET represents the complete type, and FIELDS must represent a CHOICE with a variant for each field from SET. As with SETs the field order is not guarenteed, so you’ll have map from Vec<FIELDS> to SET in decode_operation.

Implementors