#[non_exhaustive]
pub enum Tag {
}
Expand description
ASN.1 tags.
Tags are the leading identifier octet of the Tag-Length-Value encoding used by ASN.1 DER and identify the type of the subsequent value.
They are described in X.690 Section 8.1.2: Identifier octets, and structured as follows:
| Class | P/C | Tag Number |
- Bits 8/7:
Class
- Bit 6: primitive (0) or constructed (1)
- Bits 5-1: tag number
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Boolean
BOOLEAN
tag: 0x01
Integer
INTEGER
tag: 0x02
BitString
BIT STRING
tag: 0x03
OctetString
OCTET STRING
tag: 0x04
Null
NULL
tag: 0x05
ObjectIdentifier
OBJECT IDENTIFIER
tag: 0x06
Utf8String
UTF8String
tag: 0x0C
Sequence
SEQUENCE
tag: 0x10
Set
SET
and SET OF
tag: 0x11
PrintableString
PrintableString
tag: 0x13
Ia5String
IA5String
tag: 0x16
UtcTime
UTCTime
tag: 0x17
GeneralizedTime
GeneralizedTime
tag: 0x18
Application(TagNumber)
Application tag.
ContextSpecific(TagNumber)
Context-specific tag.
Private(TagNumber)
Private tag number.
Implementations
sourceimpl Tag
impl Tag
sourcepub fn assert_eq(self, expected: Tag) -> Result<Tag>
pub fn assert_eq(self, expected: Tag) -> Result<Tag>
Assert that this Tag
matches the provided expected tag.
On mismatch, returns an Error
with ErrorKind::UnexpectedTag
.
sourcepub fn non_canonical_error(self) -> Error
pub fn non_canonical_error(self) -> Error
Create an Error
for an non-canonical value with the ASN.1 type
identified by this tag.
sourcepub fn unexpected_error(self, expected: Option<Self>) -> Error
pub fn unexpected_error(self, expected: Option<Self>) -> Error
Create an Error
because the current tag was unexpected, with an
optional expected tag.
sourcepub fn value_error(self) -> Error
pub fn value_error(self) -> Error
Create an Error
for an invalid value with the ASN.1 type identified
by this tag.
Trait Implementations
sourceimpl Encodable for Tag
impl Encodable for Tag
sourcefn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
Compute the length of this value in bytes when encoded as ASN.1 DER.
sourcefn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>
Encode this value as ASN.1 DER using the provided Encoder
.
sourcefn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more
sourceimpl Ord for Tag
impl Ord for Tag
sourceimpl PartialOrd<Tag> for Tag
impl PartialOrd<Tag> for Tag
sourcefn partial_cmp(&self, other: &Tag) -> Option<Ordering>
fn partial_cmp(&self, other: &Tag) -> 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
impl Copy for Tag
impl Eq for Tag
impl StructuralEq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
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