Struct Oid
pub struct Oid<'a> { /* 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.
Implementations§
§impl<'a> Oid<'a>
impl<'a> Oid<'a>
pub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'a>
pub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'a>
Create an OID from the ASN.1 DER encoded form. See the module documentation for other ways to create oids.
pub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'a>
pub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'a>
Create a relative OID from the ASN.1 DER encoded form. See the module documentation for other ways to create relative oids.
pub fn from(s: &[u64]) -> Result<Oid<'static>, OidParseError>
pub fn from(s: &[u64]) -> Result<Oid<'static>, OidParseError>
Build an OID from an array of object identifier components. This method allocates memory on the heap.
pub fn from_relative(s: &[u64]) -> Result<Oid<'static>, OidParseError>
pub fn from_relative(s: &[u64]) -> Result<Oid<'static>, OidParseError>
Build a relative OID from an array of object identifier components.
pub 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.
pub fn bytes(&self) -> &[u8] ⓘ
👎Deprecated since 0.2.0: Use as_bytes instead
pub fn bytes(&self) -> &[u8] ⓘ
as_bytes insteadGet the encoded oid without the header.
pub fn to_id_string(&self) -> String
pub fn to_id_string(&self) -> String
Convert the OID to a string representation.
If every arc fits into a u64 a string like “1.2.840.113549.1.1.5” is returned, otherwise a hex representation.
See also the “bigint” feature of this crate.
pub fn iter(&self) -> Option<impl FusedIterator + ExactSizeIterator>
pub fn iter(&self) -> Option<impl FusedIterator + ExactSizeIterator>
Return an iterator over the sub-identifiers (arcs).
Returns None if at least one arc does not fit into u64.
pub fn from_ber_relative( bytes: &'a [u8], ) -> Result<(&'a [u8], Oid<'a>), Err<Error>>
pub fn from_der_relative( bytes: &'a [u8], ) -> Result<(&'a [u8], Oid<'a>), Err<Error>>
pub fn starts_with(&self, needle: &Oid<'_>) -> bool
pub fn starts_with(&self, needle: &Oid<'_>) -> bool
Returns true if needle is a prefix of the OID.
Trait Implementations§
§impl CheckDerConstraints for Oid<'_>
impl CheckDerConstraints for Oid<'_>
§impl ToDer for Oid<'_>
impl ToDer for Oid<'_>
§fn to_der_len(&self) -> Result<usize, Error>
fn to_der_len(&self) -> Result<usize, Error>
§fn write_der_header(
&self,
writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_header( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn write_der_content(
&self,
writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_content( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
Vec<u8>.§fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
to_vec, but uses provided values without changes.
This can generate an invalid encoding for a DER object.§fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
§fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
to_der, but uses provided values without changes.
This can generate an invalid encoding for a DER object.impl DerAutoDerive for Oid<'_>
impl<'a> Eq for Oid<'a>
impl<'a> StructuralPartialEq for Oid<'a>
Auto Trait Implementations§
impl<'a> Freeze for Oid<'a>
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> Choice for Twhere
T: Tagged,
impl<T> Choice for Twhere
T: Tagged,
§fn can_decode(tag: Tag) -> bool
fn can_decode(tag: Tag) -> bool
Tag decodable as a variant of this CHOICE?Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<'a, T, E> FromDer<'a, E> for Twhere
T: TryFrom<Any<'a>, Error = E> + CheckDerConstraints + DerAutoDerive,
E: From<Error> + Display + Debug,
impl<'a, T, E> FromDer<'a, E> for Twhere
T: TryFrom<Any<'a>, Error = E> + CheckDerConstraints + DerAutoDerive,
E: From<Error> + Display + Debug,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.