Struct der_parser::oid::Oid

source ·
pub struct Oid<'a> {
    pub relative: bool,
    /* private fields */
}
Expand description

Object ID (OID) representation which can be relative or non-relative. An example for an oid in string representation is “1.2.840.113549.1.1.5”.

For non-relative oids restrictions apply to the first two components.

This library contains a procedural macro oid which can be used to create oids. For example oid!(1.2.44.233) or oid!(rel 44.233) for relative oids. See the module documentation for more information.

Fields§

§relative: bool

Implementations§

source§

impl<'a> Oid<'a>

source

pub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'_>

Create an OID from the ASN.1 DER encoded form. See the module documentation for other ways to create oids.

source

pub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'_>

Create a relative OID from the ASN.1 DER encoded form. See the module documentation for other ways to create relative oids.

source

pub fn from<'b>(s: &'b [u64]) -> Result<Oid<'static>, ParseError>

Build an OID from an array of object identifier components. This method allocates memory on the heap.

source

pub fn from_relative<'b>(s: &'b [u64]) -> Result<Oid<'static>, ParseError>

Build a relative OID from an array of object identifier components.

source

pub fn to_owned(&self) -> Oid<'static>

Create a deep copy of the oid.

This method allocates data on the heap. The returned oid can be used without keeping the ASN.1 representation around.

Cloning the returned oid does again allocate data.

source

pub fn bytes(&self) -> &[u8]

Get the encoded oid without the header.

source

pub fn to_id_string(&self) -> String

Convert the OID to a string representation. The string contains the IDs separated by dots, for ex: “1.2.840.113549.1.1.5”

source

pub fn iter_bigint<'b>( &'b self ) -> impl Iterator<Item = BigUint> + FusedIterator + ExactSizeIterator + 'b

Return an iterator over the sub-identifiers (arcs).

source

pub fn iter<'b>( &'b self ) -> Option<impl Iterator<Item = u64> + FusedIterator + ExactSizeIterator + 'b>

Return an iterator over the sub-identifiers (arcs). Returns None if at least one arc does not fit into u64.

Trait Implementations§

source§

impl<'a> Clone for Oid<'a>

source§

fn clone(&self) -> Oid<'a>

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<'a> Debug for Oid<'a>

source§

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

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

impl<'a> Display for Oid<'a>

source§

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

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

impl<'a> From<Oid<'a>> for BerObject<'a>

Build a DER object from an OID.

source§

fn from(oid: Oid<'a>) -> BerObject<'a>

Converts to this type from the input type.
source§

impl<'a> FromStr for Oid<'a>

§

type Err = ParseError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<'a> Hash for Oid<'a>

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<'a> PartialEq<Oid<'a>> for Oid<'a>

source§

fn eq(&self, other: &Oid<'a>) -> 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<'a> Eq for Oid<'a>

source§

impl<'a> StructuralEq for Oid<'a>

source§

impl<'a> StructuralPartialEq for Oid<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Oid<'a>

§

impl<'a> Send for Oid<'a>

§

impl<'a> Sync for Oid<'a>

§

impl<'a> Unpin for Oid<'a>

§

impl<'a> UnwindSafe for Oid<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.