pub struct AnyRef<'a> { /* private fields */ }
Expand description
ASN.1 ANY
: represents any explicitly tagged ASN.1 value.
This is a zero-copy reference type which borrows from the input data.
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> AnyRef<'a>
impl<'a> AnyRef<'a>
sourcepub const NULL: Self = Self {
tag: Tag::Null,
value: ByteSlice::EMPTY,
}
pub const NULL: Self = Self { tag: Tag::Null, value: ByteSlice::EMPTY, }
AnyRef
representation of the ASN.1 NULL
type.
sourcepub fn value(self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn value(self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Get the raw value for this AnyRef
type as a byte slice.
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 AnyRef
type into the inner value.
sourcepub fn bit_string(self) -> Result<BitStringRef<'a>>
pub fn bit_string(self) -> Result<BitStringRef<'a>>
Attempt to decode an ASN.1 BIT STRING
.
sourcepub fn context_specific<T>(self) -> Result<ContextSpecific<T>> where
T: Decode<'a>,
pub fn context_specific<T>(self) -> Result<ContextSpecific<T>> where
T: Decode<'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<Ia5StringRef<'a>>
pub fn ia5_string(self) -> Result<Ia5StringRef<'a>>
Attempt to decode an ASN.1 IA5String
.
sourcepub fn octet_string(self) -> Result<OctetStringRef<'a>>
pub fn octet_string(self) -> Result<OctetStringRef<'a>>
Attempt to decode an ASN.1 OCTET STRING
.
sourcepub fn oid(self) -> Result<ObjectIdentifier>
Available on crate feature oid
only.
pub fn oid(self) -> Result<ObjectIdentifier>
oid
only.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<PrintableStringRef<'a>>
pub fn printable_string(self) -> Result<PrintableStringRef<'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<Utf8StringRef<'a>>
pub fn utf8_string(self) -> Result<Utf8StringRef<'a>>
Attempt to decode an ASN.1 UTF8String
.
Trait Implementations
sourceimpl<'a> Choice<'a> for AnyRef<'a>
impl<'a> Choice<'a> for AnyRef<'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 AnyRef<'_>
impl EncodeValue for AnyRef<'_>
sourceimpl<'a> From<&'a ObjectIdentifier> for AnyRef<'a>
impl<'a> From<&'a ObjectIdentifier> for AnyRef<'a>
sourcefn from(oid: &'a ObjectIdentifier) -> AnyRef<'a>
fn from(oid: &'a ObjectIdentifier) -> AnyRef<'a>
Converts to this type from the input type.
sourceimpl<'a> From<Ia5StringRef<'a>> for AnyRef<'a>
impl<'a> From<Ia5StringRef<'a>> for AnyRef<'a>
sourcefn from(printable_string: Ia5StringRef<'a>) -> AnyRef<'a>
fn from(printable_string: Ia5StringRef<'a>) -> AnyRef<'a>
Converts to this type from the input type.
sourceimpl<'a> From<OctetStringRef<'a>> for AnyRef<'a>
impl<'a> From<OctetStringRef<'a>> for AnyRef<'a>
sourcefn from(octet_string: OctetStringRef<'a>) -> AnyRef<'a>
fn from(octet_string: OctetStringRef<'a>) -> AnyRef<'a>
Converts to this type from the input type.
sourceimpl<'a> From<PrintableStringRef<'a>> for AnyRef<'a>
impl<'a> From<PrintableStringRef<'a>> for AnyRef<'a>
sourcefn from(printable_string: PrintableStringRef<'a>) -> AnyRef<'a>
fn from(printable_string: PrintableStringRef<'a>) -> AnyRef<'a>
Converts to this type from the input type.
sourceimpl<'a> From<Utf8StringRef<'a>> for AnyRef<'a>
impl<'a> From<Utf8StringRef<'a>> for AnyRef<'a>
sourcefn from(printable_string: Utf8StringRef<'a>) -> AnyRef<'a>
fn from(printable_string: Utf8StringRef<'a>) -> AnyRef<'a>
Converts to this type from the input type.
sourceimpl<'a> Ord for AnyRef<'a>
impl<'a> Ord for AnyRef<'a>
sourceimpl<'a> PartialOrd<AnyRef<'a>> for AnyRef<'a>
impl<'a> PartialOrd<AnyRef<'a>> for AnyRef<'a>
sourcefn partial_cmp(&self, other: &AnyRef<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &AnyRef<'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<AnyRef<'_>> for GeneralizedTime
impl TryFrom<AnyRef<'_>> for GeneralizedTime
sourceimpl TryFrom<AnyRef<'_>> for ObjectIdentifier
impl TryFrom<AnyRef<'_>> for ObjectIdentifier
sourceimpl<'a> TryFrom<AnyRef<'a>> for BitStringRef<'a>
impl<'a> TryFrom<AnyRef<'a>> for BitStringRef<'a>
sourceimpl<'a, T> TryFrom<AnyRef<'a>> for ContextSpecific<T> where
T: Decode<'a>,
impl<'a, T> TryFrom<AnyRef<'a>> for ContextSpecific<T> where
T: Decode<'a>,
sourceimpl<'a> TryFrom<AnyRef<'a>> for SystemTime
Available on crate feature std
only.
impl<'a> TryFrom<AnyRef<'a>> for SystemTime
std
only.sourceimpl<'a> TryFrom<AnyRef<'a>> for Ia5StringRef<'a>
impl<'a> TryFrom<AnyRef<'a>> for Ia5StringRef<'a>
sourceimpl<'a> TryFrom<AnyRef<'a>> for OctetStringRef<'a>
impl<'a> TryFrom<AnyRef<'a>> for OctetStringRef<'a>
sourceimpl<'a> TryFrom<AnyRef<'a>> for PrintableStringRef<'a>
impl<'a> TryFrom<AnyRef<'a>> for PrintableStringRef<'a>
sourceimpl<'a> TryFrom<AnyRef<'a>> for Utf8StringRef<'a>
impl<'a> TryFrom<AnyRef<'a>> for Utf8StringRef<'a>
impl<'a> Copy for AnyRef<'a>
impl<'a> Eq for AnyRef<'a>
impl<'a> StructuralEq for AnyRef<'a>
impl<'a> StructuralPartialEq for AnyRef<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for AnyRef<'a>
impl<'a> Send for AnyRef<'a>
impl<'a> Sync for AnyRef<'a>
impl<'a> Unpin for AnyRef<'a>
impl<'a> UnwindSafe for AnyRef<'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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more