pub struct TaggedParserBuilder<TagKind, E = Error> { /* private fields */ }
Expand description

A builder for parsing tagged values (IMPLICIT or EXPLICIT)

Examples

use asn1_rs::{Class, Tag, TaggedParserBuilder};

let parser = TaggedParserBuilder::explicit()
    .with_class(Class::ContextSpecific)
    .with_tag(Tag(0))
    .der_parser::<u32>();

let input = &[0xa0, 0x03, 0x02, 0x01, 0x02];
let (rem, tagged) = parser(input).expect("parsing failed");

assert!(rem.is_empty());
assert_eq!(tagged.tag(), Tag(0));
assert_eq!(tagged.as_ref(), &2);

Implementations

Create a default TaggedParserBuilder builder

TagKind must be specified as either Explicit or Implicit

use asn1_rs::{Explicit, TaggedParserBuilder};

let builder = TaggedParserBuilder::<Explicit>::new();

Set the expected Class for the builder

Set the expected Tag for the builder

Create a TagParser builder for EXPLICIT tagged values

Create a TagParser builder for IMPLICIT tagged values

Create the BER parser from the builder parameters

This method will consume the builder and return a parser (to be used as a function).

Create the DER parser from the builder parameters

This method will consume the builder and return a parser (to be used as a function).

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

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.