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
impl Selector
Sourcepub fn parse(text: &str, execution: &Memory) -> Result<Self>
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)?);Sourcepub fn parse_in(text: &str, parent: &Reader<'_, '_>) -> Result<Self>
pub fn parse_in(text: &str, parent: &Reader<'_, '_>) -> Result<Self>
Parses original RFC4514 text under the current producing operation. Lexical/OID conversion, BER-valued assertions, scratch and retained capacity all use that operation’s local and aggregate ceilings. Returned storage owns its account independently of the borrowed reader. Error offsets identify the textual selector, not a physical XML byte.
Sourcepub fn matches_name<W: Work>(
&self,
name: &Name<'_>,
execution: &W,
) -> Result<bool>
pub fn matches_name<W: Work>( &self, name: &Name<'_>, execution: &W, ) -> 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.