pub struct Any<'a> { /* private fields */ }
Expand description
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 which is still extensively used in things like
PKI-related RFCs.
Implementations
sourceimpl<'a> Any<'a>
impl<'a> Any<'a>
sourcepub const NULL: Self = Self {
tag: Tag::Null,
value: ByteSlice::EMPTY,
}
pub const NULL: Self = Self { tag: Tag::Null, value: ByteSlice::EMPTY, }
Any
representation of the ASN.1 NULL
type.
sourcepub fn decode_into<T>(self) -> Result<T> where
T: DecodeValue<'a> + FixedTag,
pub fn decode_into<T>(self) -> Result<T> where
T: DecodeValue<'a> + FixedTag,
Attempt to decode this Any
type into the inner value.
sourcepub fn bit_string(self) -> Result<BitString<'a>>
pub fn bit_string(self) -> Result<BitString<'a>>
Attempt to decode an ASN.1 BIT STRING
.
sourcepub fn context_specific<T>(self) -> Result<ContextSpecific<T>> where
T: Decodable<'a>,
pub fn context_specific<T>(self) -> Result<ContextSpecific<T>> where
T: Decodable<'a>,
Attempt to decode an ASN.1 CONTEXT-SPECIFIC
field.
sourcepub fn generalized_time(self) -> Result<GeneralizedTime>
pub fn generalized_time(self) -> Result<GeneralizedTime>
Attempt to decode an ASN.1 GeneralizedTime
.
sourcepub fn ia5_string(self) -> Result<Ia5String<'a>>
pub fn ia5_string(self) -> Result<Ia5String<'a>>
Attempt to decode an ASN.1 IA5String
.
sourcepub fn octet_string(self) -> Result<OctetString<'a>>
pub fn octet_string(self) -> Result<OctetString<'a>>
Attempt to decode an ASN.1 OCTET STRING
.
sourcepub fn oid(self) -> Result<ObjectIdentifier>
pub fn oid(self) -> Result<ObjectIdentifier>
Attempt to decode an ASN.1 OBJECT IDENTIFIER
.
sourcepub fn optional<T>(self) -> Result<Option<T>> where
T: Choice<'a> + TryFrom<Self, Error = Error>,
pub fn optional<T>(self) -> Result<Option<T>> where
T: Choice<'a> + TryFrom<Self, Error = Error>,
Attempt to decode an ASN.1 OPTIONAL
value.
sourcepub fn printable_string(self) -> Result<PrintableString<'a>>
pub fn printable_string(self) -> Result<PrintableString<'a>>
Attempt to decode an ASN.1 PrintableString
.
sourcepub fn sequence<F, T>(self, f: F) -> Result<T> where
F: FnOnce(&mut Decoder<'a>) -> Result<T>,
pub fn sequence<F, T>(self, f: F) -> Result<T> where
F: FnOnce(&mut Decoder<'a>) -> Result<T>,
Attempt to decode this value an ASN.1 SEQUENCE
, creating a new
nested Decoder
and calling the provided argument with it.
sourcepub fn utf8_string(self) -> Result<Utf8String<'a>>
pub fn utf8_string(self) -> Result<Utf8String<'a>>
Attempt to decode an ASN.1 UTF8String
.
Trait Implementations
sourceimpl<'a> Choice<'a> for Any<'a>
impl<'a> Choice<'a> for Any<'a>
sourcefn can_decode(_: Tag) -> bool
fn can_decode(_: Tag) -> bool
Is the provided Tag
decodable as a variant of this CHOICE
?
sourceimpl EncodeValue for Any<'_>
impl EncodeValue for Any<'_>
sourceimpl<'a> From<&'a ObjectIdentifier> for Any<'a>
impl<'a> From<&'a ObjectIdentifier> for Any<'a>
sourcefn from(oid: &'a ObjectIdentifier) -> Any<'a>
fn from(oid: &'a ObjectIdentifier) -> Any<'a>
Converts to this type from the input type.
sourceimpl<'a> From<OctetString<'a>> for Any<'a>
impl<'a> From<OctetString<'a>> for Any<'a>
sourcefn from(octet_string: OctetString<'a>) -> Any<'a>
fn from(octet_string: OctetString<'a>) -> Any<'a>
Converts to this type from the input type.
sourceimpl<'a> From<PrintableString<'a>> for Any<'a>
impl<'a> From<PrintableString<'a>> for Any<'a>
sourcefn from(printable_string: PrintableString<'a>) -> Any<'a>
fn from(printable_string: PrintableString<'a>) -> Any<'a>
Converts to this type from the input type.
sourceimpl<'a> From<Utf8String<'a>> for Any<'a>
impl<'a> From<Utf8String<'a>> for Any<'a>
sourcefn from(printable_string: Utf8String<'a>) -> Any<'a>
fn from(printable_string: Utf8String<'a>) -> Any<'a>
Converts to this type from the input type.
sourceimpl<'a> Ord for Any<'a>
impl<'a> Ord for Any<'a>
sourceimpl<'a> PartialOrd<Any<'a>> for Any<'a>
impl<'a> PartialOrd<Any<'a>> for Any<'a>
sourcefn partial_cmp(&self, other: &Any<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &Any<'a>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryFrom<Any<'_>> for GeneralizedTime
impl TryFrom<Any<'_>> for GeneralizedTime
sourceimpl TryFrom<Any<'_>> for ObjectIdentifier
impl TryFrom<Any<'_>> for ObjectIdentifier
sourceimpl<'a, T> TryFrom<Any<'a>> for ContextSpecific<T> where
T: Decodable<'a>,
impl<'a, T> TryFrom<Any<'a>> for ContextSpecific<T> where
T: Decodable<'a>,
sourceimpl<'a> TryFrom<Any<'a>> for OctetString<'a>
impl<'a> TryFrom<Any<'a>> for OctetString<'a>
sourceimpl<'a> TryFrom<Any<'a>> for PrintableString<'a>
impl<'a> TryFrom<Any<'a>> for PrintableString<'a>
sourceimpl<'a> TryFrom<Any<'a>> for Utf8String<'a>
impl<'a> TryFrom<Any<'a>> for Utf8String<'a>
impl<'a> Copy for Any<'a>
impl<'a> Eq for Any<'a>
impl<'a> StructuralEq for Any<'a>
impl<'a> StructuralPartialEq for Any<'a>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more