Struct der::Any[][src]

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

ASN.1 ANY: represents any explicitly tagged ASN.1 value.

Technically ANY hasn’t been a recommended part of ASN.1 since the X.209 revision from 1988. It was deprecated and replaced by Information Object Classes in X.680 in 1994, and X.690 no longer refers to it whatsoever.

Nevertheless, this crate defines an Any type as it remains a familiar and useful concept, although the usage within arguably resembles the type system concept more than the original ASN.1 concept.

Implementations

impl<'a> Any<'a>[src]

pub fn new(tag: Tag, value: &'a [u8]) -> Result<Self>[src]

Create a new Any from the provided Tag and slice.

pub fn tag(self) -> Tag[src]

Get the tag for this Any type.

pub fn len(self) -> Length[src]

Get the Length of this Any type’s value.

pub fn is_empty(self) -> bool[src]

Is the body of this Any type empty?

pub fn is_null(self) -> bool[src]

Is this value an ASN.1 NULL value?

pub fn as_bytes(self) -> &'a [u8][src]

Get the raw value for this Any type as a byte slice.

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

Attempt to decode an ASN.1 BIT STRING.

pub fn generalized_time(self) -> Result<GeneralizedTime>[src]

Attempt to decode an ASN.1 GeneralizedTime.

pub fn ia5_string(self) -> Result<Ia5String<'a>>[src]

Attempt to decode an ASN.1 IA5String.

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

👎 Deprecated since 0.2.4:

Please use the is_null function instead

Attempt to decode an ASN.1 NULL value.

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

Attempt to decode an ASN.1 OCTET STRING.

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

This is supported on crate feature oid only.

Attempt to decode an ASN.1 OBJECT IDENTIFIER.

pub fn printable_string(self) -> Result<PrintableString<'a>>[src]

Attempt to decode an ASN.1 PrintableString.

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

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

pub fn utc_time(self) -> Result<UtcTime>[src]

Attempt to decode an ASN.1 UTCTime.

pub fn utf8_string(self) -> Result<Utf8String<'a>>[src]

Attempt to decode an ASN.1 UTF8String.

Trait Implementations

impl<'a> Choice<'a> for Any<'a>[src]

impl<'a> Clone for Any<'a>[src]

impl<'a> Copy for Any<'a>[src]

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

impl<'a> Decodable<'a> for Any<'a>[src]

impl<'a> Encodable for Any<'a>[src]

impl<'a> Eq for Any<'a>[src]

impl<'a> From<()> for Any<'a>[src]

impl<'a> From<BitString<'a>> for Any<'a>[src]

impl<'a> From<Ia5String<'a>> for Any<'a>[src]

impl<'a> From<Null> for Any<'a>[src]

impl<'a> From<OctetString<'a>> for Any<'a>[src]

impl<'a> From<PrintableString<'a>> for Any<'a>[src]

impl<'a> From<Sequence<'a>> for Any<'a>[src]

impl<'a> From<Utf8String<'a>> for Any<'a>[src]

impl<'a> PartialEq<Any<'a>> for Any<'a>[src]

impl<'a> StructuralEq for Any<'a>[src]

impl<'a> StructuralPartialEq for Any<'a>[src]

impl<'a> TryFrom<&'a [u8]> for Any<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Any<'_>> for GeneralizedTime[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Any<'_>> for Null[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Any<'_>> for ObjectIdentifier[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Any<'_>> for UtcTime[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a, N: BigUIntSize> TryFrom<Any<'a>> for BigUInt<'a, N>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for BitString<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for Ia5String<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for OctetString<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for PrintableString<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for Sequence<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<Any<'a>> for Utf8String<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Any<'a>

impl<'a> Send for Any<'a>

impl<'a> Sync for Any<'a>

impl<'a> Unpin for Any<'a>

impl<'a> UnwindSafe for Any<'a>

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> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.