Struct x509_parser::x509::AttributeTypeAndValue
source · pub struct AttributeTypeAndValue<'a> { /* private fields */ }
Expand description
A generic attribute type and value
These objects are used as RelativeDistinguishedName
components.
Implementations§
source§impl<'a> AttributeTypeAndValue<'a>
impl<'a> AttributeTypeAndValue<'a>
sourcepub const fn new(attr_type: Oid<'a>, attr_value: Any<'a>) -> Self
pub const fn new(attr_type: Oid<'a>, attr_value: Any<'a>) -> Self
Builds a new AttributeTypeAndValue
sourcepub const fn attr_value(&self) -> &Any<'a>
pub const fn attr_value(&self) -> &Any<'a>
Returns the attribute value, as ANY
sourcepub fn as_str(&self) -> Result<&'a str, X509Error>
pub fn as_str(&self) -> Result<&'a str, X509Error>
Attempt to get the content as str
.
This can fail if the object does not contain a string type.
Note: the TryFrom
trait is implemented for &str
, so this is
equivalent to attr.try_into()
.
Only NumericString, PrintableString, UTF8String and IA5String
are considered here. Other string types can be read using as_slice
.
Trait Implementations§
source§impl<'a> Clone for AttributeTypeAndValue<'a>
impl<'a> Clone for AttributeTypeAndValue<'a>
source§fn clone(&self) -> AttributeTypeAndValue<'a>
fn clone(&self) -> AttributeTypeAndValue<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for AttributeTypeAndValue<'a>
impl<'a> Debug for AttributeTypeAndValue<'a>
source§impl<'a, 'b> From<&'a AttributeTypeAndValue<'b>> for &'a [u8]
impl<'a, 'b> From<&'a AttributeTypeAndValue<'b>> for &'a [u8]
source§fn from(value: &'a AttributeTypeAndValue<'b>) -> Self
fn from(value: &'a AttributeTypeAndValue<'b>) -> Self
Converts to this type from the input type.
source§impl<'a> FromDer<'a, X509Error> for AttributeTypeAndValue<'a>
impl<'a> FromDer<'a, X509Error> for AttributeTypeAndValue<'a>
source§fn from_der(i: &'a [u8]) -> X509Result<'a, Self>
fn from_der(i: &'a [u8]) -> X509Result<'a, Self>
Attempt to parse input bytes into a DER object (enforcing constraints)
source§impl<'a> FromIterator<AttributeTypeAndValue<'a>> for RelativeDistinguishedName<'a>
impl<'a> FromIterator<AttributeTypeAndValue<'a>> for RelativeDistinguishedName<'a>
source§fn from_iter<T: IntoIterator<Item = AttributeTypeAndValue<'a>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = AttributeTypeAndValue<'a>>>(iter: T) -> Self
Creates a value from an iterator. Read more
source§impl<'a> PartialEq for AttributeTypeAndValue<'a>
impl<'a> PartialEq for AttributeTypeAndValue<'a>
source§impl<'a, 'b> TryFrom<&'a AttributeTypeAndValue<'b>> for &'a str
impl<'a, 'b> TryFrom<&'a AttributeTypeAndValue<'b>> for &'a str
impl<'a> StructuralPartialEq for AttributeTypeAndValue<'a>
Auto Trait Implementations§
impl<'a> Freeze for AttributeTypeAndValue<'a>
impl<'a> RefUnwindSafe for AttributeTypeAndValue<'a>
impl<'a> Send for AttributeTypeAndValue<'a>
impl<'a> Sync for AttributeTypeAndValue<'a>
impl<'a> Unpin for AttributeTypeAndValue<'a>
impl<'a> UnwindSafe for AttributeTypeAndValue<'a>
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)