Struct der::ObjectIdentifier [−][src]
pub struct ObjectIdentifier { /* fields omitted */ }oid only.Expand description
Object identifier (OID).
OIDs are hierarchical structures consisting of “arcs”, i.e. integer identifiers.
Validity
In order for an OID to be considered valid by this library, it must meet the following criteria:
- The OID MUST have at least 3 arcs
- The first arc MUST be within the range 0-2
- The second arc MUST be within the range 0-39
- The BER/DER encoding of the OID MUST be shorter than
ObjectIdentifier::max_len
Implementations
impl ObjectIdentifier[src]
impl ObjectIdentifier[src]pub const MAX_LENGTH: usize[src]
pub const MAX_LENGTH: usize[src]Maximum length of a BER/DER-encoded OID in bytes.
pub const fn max_len() -> usize[src]
👎 Deprecated since 0.5.1: please use ObjectIdentifier::MAX_LENGTH
pub const fn max_len() -> usize[src]please use ObjectIdentifier::MAX_LENGTH
Maximum length of a BER/DER-encoded OID in bytes.
pub const fn new(s: &str) -> ObjectIdentifier[src]
pub const fn new(s: &str) -> ObjectIdentifier[src]Parse an ObjectIdentifier from the dot-delimited string form, e.g.:
use const_oid::ObjectIdentifier; pub const MY_OID: ObjectIdentifier = ObjectIdentifier::new("1.2.840.113549.1.1.1");
Panics
This method panics in the event the OID is malformed according to the “Validity” rules given in the toplevel documentation for this type.
For that reason this method is ONLY recommended for use in constants (where it will generate a compiler error instead).
To parse an OID from a &str slice fallibly and without panicking,
use the FromStr impl instead (or via str’s parse
method).
pub fn from_arcs(arcs: &[u32]) -> Result<ObjectIdentifier, Error>[src]
pub fn from_arcs(arcs: &[u32]) -> Result<ObjectIdentifier, Error>[src]Parse an OID from a slice of Arc values (i.e. integers).
pub fn from_bytes(ber_bytes: &[u8]) -> Result<ObjectIdentifier, Error>[src]
pub fn from_bytes(ber_bytes: &[u8]) -> Result<ObjectIdentifier, Error>[src]Parse an OID from from its BER/DER encoding.
pub fn as_bytes(&self) -> &[u8][src]
pub fn as_bytes(&self) -> &[u8][src]Get the BER/DER serialization of this OID as bytes.
Note that this encoding omits the tag/length, and only contains the value portion of the encoded OID.
pub fn arc(&self, index: usize) -> Option<u32>[src]
pub fn arc(&self, index: usize) -> Option<u32>[src]Return the arc with the given index, if it exists.
pub fn arcs(&self) -> Arcs<'_>[src]
pub fn arcs(&self) -> Arcs<'_>[src]Iterate over the arcs (a.k.a. nodes) of an ObjectIdentifier.
Returns Arcs, an iterator over Arc values representing the value
of each arc/node.
Trait Implementations
impl Clone for ObjectIdentifier[src]
impl Clone for ObjectIdentifier[src]pub fn clone(&self) -> ObjectIdentifier[src]
pub fn clone(&self) -> ObjectIdentifier[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl Debug for ObjectIdentifier[src]
impl Debug for ObjectIdentifier[src]impl Display for ObjectIdentifier[src]
impl Display for ObjectIdentifier[src]impl Encodable for ObjectIdentifier[src]
impl Encodable for ObjectIdentifier[src]fn encoded_len(&self) -> Result<Length>[src]
fn encoded_len(&self) -> Result<Length>[src]Compute the length of this value in bytes when encoded as ASN.1 DER.
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>[src]
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>[src]Encode this value as ASN.1 DER using the provided Encoder.
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>[src]
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>[src]Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more
impl<'_> From<&'_ ObjectIdentifier> for ObjectIdentifier[src]
impl<'_> From<&'_ ObjectIdentifier> for ObjectIdentifier[src]pub fn from(oid: &ObjectIdentifier) -> ObjectIdentifier[src]
pub fn from(oid: &ObjectIdentifier) -> ObjectIdentifier[src]Performs the conversion.
impl<'a> From<&'a ObjectIdentifier> for Any<'a>[src]
impl<'a> From<&'a ObjectIdentifier> for Any<'a>[src]fn from(oid: &'a ObjectIdentifier) -> Any<'a>[src]
fn from(oid: &'a ObjectIdentifier) -> Any<'a>[src]Performs the conversion.
impl FromStr for ObjectIdentifier[src]
impl FromStr for ObjectIdentifier[src]impl Hash for ObjectIdentifier[src]
impl Hash for ObjectIdentifier[src]impl Ord for ObjectIdentifier[src]
impl Ord for ObjectIdentifier[src]impl PartialEq<ObjectIdentifier> for ObjectIdentifier[src]
impl PartialEq<ObjectIdentifier> for ObjectIdentifier[src]pub fn eq(&self, other: &ObjectIdentifier) -> bool[src]
pub fn eq(&self, other: &ObjectIdentifier) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &ObjectIdentifier) -> bool[src]
pub fn ne(&self, other: &ObjectIdentifier) -> bool[src]This method tests for !=.
impl PartialOrd<ObjectIdentifier> for ObjectIdentifier[src]
impl PartialOrd<ObjectIdentifier> for ObjectIdentifier[src]pub fn partial_cmp(&self, other: &ObjectIdentifier) -> Option<Ordering>[src]
pub fn partial_cmp(&self, other: &ObjectIdentifier) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl TryFrom<Any<'_>> for ObjectIdentifier[src]
impl TryFrom<Any<'_>> for ObjectIdentifier[src]impl Copy for ObjectIdentifier[src]
impl Eq for ObjectIdentifier[src]
impl StructuralEq for ObjectIdentifier[src]
impl StructuralPartialEq for ObjectIdentifier[src]
Auto Trait Implementations
impl RefUnwindSafe for ObjectIdentifier
impl Send for ObjectIdentifier
impl Sync for ObjectIdentifier
impl Unpin for ObjectIdentifier
impl UnwindSafe for ObjectIdentifier
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more