Skip to main content

Selector

Struct Selector 

Source
pub struct Selector { /* private fields */ }
Expand description

An independently owned RFC 4514 distinguished-name assertion.

Parsing is strict: separator whitespace is not implicitly discarded. Values retain their decoded assertion octets or complete original BER. RDN order and unordered membership use the certificate Name’s shared comparison core. Storage remains charged after the parser/account handle is dropped; each subsequent operation takes its own execution account.

Implementations§

Source§

impl Selector

Source

pub fn parse(text: &str, execution: &Memory) -> Result<Self>

Parses the grammar of RFC 4514 §3 without compatibility trimming. Unknown numeric types are preserved. An unknown descriptor, malformed escape, incomplete BER value or syntax violation is a located error; unavailable equality semantics remain distinct at comparison time.

use std::sync::Arc;
use structured_asn1::memory::{Memory, MemoryAccount};
use structured_pkix::name::Selector;
let memory = Memory::new(Arc::new(MemoryAccount::new(4096, 100_000)));
let left = Selector::parse("CN=A\\,B,O=Example", &memory)?;
let right = Selector::parse("cn=A\\2CB,o=example", &memory)?;
assert!(left.matches(&right, &memory)?);
Source

pub fn matches_name(&self, name: &Name<'_>, execution: &Memory) -> Result<bool>

Compares directly with a certificate Name without serializing it. Unknown LDAP assertion syntax returns UnsupportedNameSyntax when semantic preparation is needed; it is never guessed as UTF8String.

Source

pub fn matches(&self, other: &Self, execution: &Memory) -> Result<bool>

Compares two independently owned selectors under the same Name rules.

Trait Implementations§

Source§

impl Debug for Selector

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.