[][src]Struct red_asn1::Tag

pub struct Tag {
    pub number: u8,
    pub type: TagType,
    pub class: TagClass,
}

Class to represent DER-ASN1 tags of the different types.

Each tag is divided into 3 parts:

  • Class: If tag is of an Primitive or Constructed object
  • Type: The scope of the object
  • Number: A distinguished number between objects of the same type and class

Fields

number: u8type: TagTypeclass: TagClass

Implementations

impl Tag[src]

pub fn new(number: u8, r#type: TagType, class: TagClass) -> Tag[src]

Creates a new tag from a given number, type and class

pub fn new_primitive_universal(number: u8) -> Tag[src]

Shorcut of: Tag::new(tag_number, TagType::Primitive, TagClass::Universal)

pub fn new_constructed_universal(number: u8) -> Tag[src]

Shorcut of: Tag::new(tag_number, TagType::Constructed, TagClass::Universal)

pub fn build(&self) -> Vec<u8>[src]

Produces an DER version of the tag in bytes

pub fn parse(raw: &[u8]) -> Result<(&[u8], Self)>[src]

Set the Tag values from a array of bytes

Trait Implementations

impl Clone for Tag[src]

impl Copy for Tag[src]

impl Debug for Tag[src]

impl Default for Tag[src]

impl PartialEq<Tag> for Tag[src]

impl StructuralPartialEq for Tag[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.