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>
impl<'a> Oid<'a>
sourcepub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'_>
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.
sourcepub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'_>
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.
sourcepub fn from<'b>(s: &'b [u64]) -> Result<Oid<'static>, ParseError>
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.
sourcepub fn from_relative<'b>(s: &'b [u64]) -> Result<Oid<'static>, ParseError>
pub fn from_relative<'b>(s: &'b [u64]) -> Result<Oid<'static>, ParseError>
Build a relative OID from an array of object identifier components.
sourcepub fn to_owned(&self) -> Oid<'static>
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.
sourcepub fn to_id_string(&self) -> String
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”
sourcepub fn iter_bigint<'b>(
&'b self
) -> impl Iterator<Item = BigUint> + FusedIterator + ExactSizeIterator + 'b
pub fn iter_bigint<'b>( &'b self ) -> impl Iterator<Item = BigUint> + FusedIterator + ExactSizeIterator + 'b
Return an iterator over the sub-identifiers (arcs).
sourcepub fn iter<'b>(
&'b self
) -> Option<impl Iterator<Item = u64> + FusedIterator + ExactSizeIterator + 'b>
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
.