Struct der::TagNumber

source ·
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

source

pub const N0: Self = _

Tag number 0

source

pub const N1: Self = _

Tag number 1

source

pub const N2: Self = _

Tag number 2

source

pub const N3: Self = _

Tag number 3

source

pub const N4: Self = _

Tag number 4

source

pub const N5: Self = _

Tag number 5

source

pub const N6: Self = _

Tag number 6

source

pub const N7: Self = _

Tag number 7

source

pub const N8: Self = _

Tag number 8

source

pub const N9: Self = _

Tag number 9

source

pub const N10: Self = _

Tag number 10

source

pub const N11: Self = _

Tag number 11

source

pub const N12: Self = _

Tag number 12

source

pub const N13: Self = _

Tag number 13

source

pub const N14: Self = _

Tag number 14

source

pub const N15: Self = _

Tag number 15

source

pub const N16: Self = _

Tag number 16

source

pub const N17: Self = _

Tag number 17

source

pub const N18: Self = _

Tag number 18

source

pub const N19: Self = _

Tag number 19

source

pub const N20: Self = _

Tag number 20

source

pub const N21: Self = _

Tag number 21

source

pub const N22: Self = _

Tag number 22

source

pub const N23: Self = _

Tag number 23

source

pub const N24: Self = _

Tag number 24

source

pub const N25: Self = _

Tag number 25

source

pub const N26: Self = _

Tag number 26

source

pub const N27: Self = _

Tag number 27

source

pub const N28: Self = _

Tag number 28

source

pub const N29: Self = _

Tag number 29

source

pub const N30: Self = _

Tag number 30

source

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.

source

pub fn application(self, constructed: bool) -> Tag

Create an APPLICATION tag with this tag number.

source

pub fn context_specific(self, constructed: bool) -> Tag

Create a CONTEXT-SPECIFIC tag with this tag number.

source

pub fn private(self, constructed: bool) -> Tag

Create a PRIVATE tag with this tag number.

source

pub fn value(self) -> u8

Get the inner value.

Trait Implementations§

source§

impl Clone for TagNumber

source§

fn clone(&self) -> TagNumber

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TagNumber

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for TagNumber

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<TagNumber> for u8

source§

fn from(tag_number: TagNumber) -> u8

Converts to this type from the input type.
source§

impl Ord for TagNumber

source§

fn cmp(&self, other: &TagNumber) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for TagNumber

source§

fn eq(&self, other: &TagNumber) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for TagNumber

source§

fn partial_cmp(&self, other: &TagNumber) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<u8> for TagNumber

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(byte: u8) -> Result<Self>

Performs the conversion.
source§

impl Copy for TagNumber

source§

impl Eq for TagNumber

source§

impl StructuralPartialEq for TagNumber

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.