Skip to main content

Tag

Enum Tag 

Source
pub enum Tag {
    Anonymous,
    Context(u8),
    Common(u32),
    Implicit(u32),
    FullyQualified {
        vendor: u16,
        profile: u16,
        number: u32,
    },
}
Expand description

An element’s tag (Core §A.2).

A tag is optional: an element without one is anonymous. The rest identify the element either within its containing structure (context-specific) or globally (profile-specific).

Variants§

§

Anonymous

No tag — §A.2.3. The only form allowed for array members and for the outermost element of an encoding.

§

Context(u8)

A context-specific tag: one octet, meaningful only inside its containing structure or list (§A.2.2).

§

Common(u32)

A tag in the Matter Common Profile (§A.8.3).

§

Implicit(u32)

A profile-specific tag whose vendor and profile come from the protocol context the encoding travels in (§A.8.2).

§

FullyQualified

A fully-qualified profile-specific tag (§A.8.1).

Fields

§vendor: u16

The 16-bit Vendor ID.

§profile: u16

The 16-bit profile number.

§number: u32

The tag number: 16-bit on the wire when below 65536, else 32-bit.

Implementations§

Source§

impl Tag

Source

pub const fn is_anonymous(self) -> bool

Whether this is Tag::Anonymous.

Source

pub const fn context(self) -> Option<u8>

The context-specific tag number, if this is one.

Source

pub const fn encoded_len(self) -> usize

How many octets this tag occupies on the wire.

Source

pub fn canonical_cmp(self, other: Self) -> Ordering

Orders two tags by the canonical rules of §A.2.4, which a signature over a structure depends on.

The rules are stated in terms of Vendor ID and profile number, so Tag::Implicit — whose vendor and profile come from the protocol context — has no defined place among fully-qualified tags. It is ordered after Tag::Common and before Tag::FullyQualified here; a caller that mixes implicit tags with fully-qualified ones in one container and then signs it must resolve the implicit ones to their profile first.

Trait Implementations§

Source§

impl Clone for Tag

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Tag

Source§

impl Debug for Tag

Source§

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

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

impl Eq for Tag

Source§

impl Hash for Tag

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Tag

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Tag

Auto Trait Implementations§

§

impl Forget for Tag

§

impl Freeze for Tag

§

impl Move for Tag

§

impl RefUnwindSafe for Tag

§

impl Send for Tag

§

impl Sync for Tag

§

impl Unpin for Tag

§

impl UnsafeUnpin 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.