Skip to main content

DnAttribute

Struct DnAttribute 

Source
pub struct DnAttribute<'a> {
    pub kind: DnAttributeKind,
    pub printable_string: bool,
    pub value: DnValue<'a>,
}
Available on crate feature rustcrypto only.
Expand description

One attribute of a distinguished name.

Fields§

§kind: DnAttributeKind

Which attribute type this is.

§printable_string: bool

Whether the X.509 form encodes the value as a PrintableString rather than a UTF8String. Only meaningful when DnAttributeKind::has_printable_string_form; always false otherwise.

§value: DnValue<'a>

The value.

Implementations§

Source§

impl<'a> DnAttribute<'a>

Source

pub const fn string(kind: DnAttributeKind, value: &'a str) -> Self

A string attribute in its UTF8String form.

Source

pub const fn printable(kind: DnAttributeKind, value: &'a str) -> Self

A string attribute in its PrintableString form — the +0x80 tag.

Source

pub const fn uint(kind: DnAttributeKind, value: u64) -> Self

A Matter-specific scalar attribute.

Source

pub const fn node_id(id: NodeId) -> Self

matter-node-id.

Source

pub const fn fabric_id(id: FabricId) -> Self

matter-fabric-id.

Source

pub const fn noc_cat(cat: CaseAuthenticatedTag) -> Self

matter-noc-cat.

Source

pub const fn tag(&self) -> u8

The TLV context tag this attribute encodes under, +0x80 included.

Source

pub const fn as_uint(&self) -> Option<u64>

The scalar, if this is a Matter-specific attribute.

Source

pub const fn as_str(&self) -> Option<&'a str>

The text, if this is a string attribute.

Source

pub fn validate(&self) -> Result<()>

Checks the attribute against the rules of §6.1.1 and §6.5.6.1.

A scalar whose type says four octets must fit in 32 bits, a string type must carry a string, and the +0x80 form must only be used where Table 87 defines one.

Source

pub fn encode(&self, writer: &mut TlvWriter<'_>) -> Result<()>

Writes the attribute into an open issuer or subject list.

Source

pub fn decode(element: &Element<'a>) -> Result<Self>

Reads one attribute from an element inside a DN list.

Trait Implementations§

Source§

impl<'a> Clone for DnAttribute<'a>

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<'a> Copy for DnAttribute<'a>

Source§

impl<'a> Debug for DnAttribute<'a>

Source§

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

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

impl<'a> Eq for DnAttribute<'a>

Source§

impl<'a> PartialEq for DnAttribute<'a>

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<'a> StructuralPartialEq for DnAttribute<'a>

Auto Trait Implementations§

§

impl<'a> Forget for DnAttribute<'a>

§

impl<'a> Freeze for DnAttribute<'a>

§

impl<'a> Move for DnAttribute<'a>

§

impl<'a> RefUnwindSafe for DnAttribute<'a>

§

impl<'a> Send for DnAttribute<'a>

§

impl<'a> Sync for DnAttribute<'a>

§

impl<'a> Unpin for DnAttribute<'a>

§

impl<'a> UnsafeUnpin for DnAttribute<'a>

§

impl<'a> UnwindSafe for DnAttribute<'a>

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.