Struct flexiber::Tag

source ·
pub struct Tag {
    pub class: Class,
    pub constructed: bool,
    pub number: u16,
}
Expand description

The tag field consists of a single byte encoding a tag number from 1 to 254. The values ‘00’ and ‘FF’ are invalid.

Fields§

§class: Class§constructed: bool§number: u16

Implementations§

source§

impl Tag

source

pub const BOOLEAN: Self = _

source

pub const INTEGER: Self = _

source

pub const BIT_STRING: Self = _

source

pub const OCTET_STRING: Self = _

source

pub const NULL: Self = _

source

pub const OBJECT_IDENTIFIER: Self = _

source

pub const UTF8_STRING: Self = _

source

pub const PRINTABLE_STRING: Self = _

source

pub const UTC_TIME: Self = _

source

pub const GENERALIZED_TIME: Self = _

source

pub const SEQUENCE: Self = _

source

pub const SET: Self = _

source

pub fn from(class: Class, constructed: bool, number: u16) -> Self

source

pub const fn universal(number: u16) -> Self

source

pub const fn application(number: u16) -> Self

source

pub const fn context(number: u16) -> Self

source

pub const fn private(number: u16) -> Self

source

pub const fn constructed(self) -> Self

Trait Implementations§

source§

impl Clone for Tag

source§

fn clone(&self) -> Tag

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 Tag

source§

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

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

impl Decodable<'_> for Tag

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

Attempt to decode this message using the provided decoder.
source§

fn from_bytes(bytes: &'a [u8]) -> Result<Self>

Parse Self from the provided byte slice.
source§

impl Display for Tag

source§

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

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

impl Encodable for Tag

source§

fn encoded_length(&self) -> Result<Length>

Compute the length of this value in bytes when encoded as BER-TLV
source§

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>

Encode this value as BER-TLV using the provided Encoder.
source§

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.
source§

impl PartialEq for Tag

source§

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

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

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

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

impl TagLike for Tag

source§

fn embedding(self) -> Tag

To stick with one Error type, make sure the tag type can somehow or other be coerced into a BerTag.
source§

fn assert_eq(self, expected: Self) -> Result<Self>

Assert that this Tag matches the provided expected tag. Read more
source§

fn with_value<V>(self, value: V) -> TaggedValue<V, Self>

Ergonomic way to get a TaggedValue for a given tag and value
source§

impl TryFrom<&[u8]> for Tag

§

type Error = Error

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

fn try_from(encoding: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<u8> for Tag

§

type Error = Error

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

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

Performs the conversion.
source§

impl Copy for Tag

source§

impl Eq for Tag

source§

impl StructuralEq for Tag

source§

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§

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> 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.