pub struct TagNumber(/* private fields */);
Expand description
ASN.1 tag numbers (i.e. lower 5 bits of a Tag
).
From X.690 Section 8.1.2.2:
bits 5 to 1 shall encode the number of the tag as a binary integer with bit 5 as the most significant bit.
This library supports tag numbers ranging from zero to 30 (inclusive), which can be represented as a single identifier octet.
Section 8.1.2.4 describes how to support multi-byte tag numbers, which are
encoded by using a leading tag number of 31 (0b11111
). This library
deliberately does not support this: tag numbers greater than 30 are
disallowed.
Implementations§
source§impl TagNumber
impl TagNumber
sourcepub const fn new(byte: u8) -> Self
pub const fn new(byte: u8) -> Self
Create a new tag number (const-friendly).
Panics if the tag number is greater than 30
.
For a fallible conversion, use TryFrom
instead.
sourcepub fn application(self, constructed: bool) -> Tag
pub fn application(self, constructed: bool) -> Tag
Create an APPLICATION
tag with this tag number.
sourcepub fn context_specific(self, constructed: bool) -> Tag
pub fn context_specific(self, constructed: bool) -> Tag
Create a CONTEXT-SPECIFIC
tag with this tag number.
Trait Implementations§
source§impl Ord for TagNumber
impl Ord for TagNumber
source§impl PartialEq for TagNumber
impl PartialEq for TagNumber
source§impl PartialOrd for TagNumber
impl PartialOrd for TagNumber
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for TagNumber
impl Eq for TagNumber
impl StructuralPartialEq for TagNumber
Auto Trait Implementations§
impl Freeze for TagNumber
impl RefUnwindSafe for TagNumber
impl Send for TagNumber
impl Sync for TagNumber
impl Unpin for TagNumber
impl UnwindSafe for TagNumber
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)