Type Alias rocket::mtls::oid::asn1_rs::OptTaggedImplicit

source ·
pub type OptTaggedImplicit<T, const TAG: u32> = Option<TaggedValue<T, Implicit, asn1_rs::::asn1_types::tagged::implicit::TaggedImplicit::{constant#0}, TAG>>;
Available on crate feature mtls only.
Expand description

A helper object to parse [ n ] IMPLICIT T OPTIONAL

A helper object implementing FromBer and FromDer, to parse tagged optional values.

This helper expects context-specific tags. Use Option< TaggedValue > for a more generic implementation.


To parse a [0] IMPLICIT INTEGER OPTIONAL object:

use asn1_rs::{FromBer, Integer, OptTaggedImplicit, TaggedValue};

let bytes = &[0xa0, 0x1, 0x2];

let (_, tagged) = OptTaggedImplicit::<Integer, 0>::from_ber(bytes).unwrap();
assert_eq!(tagged, Some(TaggedValue::implicit(Integer::from(2))));

// If tagged object is not present or has different tag, parsing
// also succeeds (returning None):
let (_, tagged) = OptTaggedImplicit::<Integer, 0>::from_ber(&[]).unwrap();
assert_eq!(tagged, None);

Aliased Type§

enum OptTaggedImplicit<T, const TAG: u32> {
    Some(TaggedValue<T, Implicit, 2, TAG>),




No value.


Some(TaggedValue<T, Implicit, 2, TAG>)

Some value of type T.