pub struct SimpleDN { /* private fields */ }Expand description
LDAP Distinguished Name
Only deals with the common DNs of the form: “CN=Tea,OU=Leaves,OU=Are,DC=Great,DC=Org”
Multivalued relative DNs and unprintable characters are not supported, and neither is the empty DN.
use simple_ldap::SimpleDN;
use std::str::FromStr;
// Create a new DN from a string slice
let dn = SimpleDN::from_str("CN=hong,OU=cha,DC=tea").unwrap();If you do need to handle more exotic DNs, have a look at the crate ldap_types.
Implementations§
Source§impl SimpleDN
Convenience operations for DNs.
impl SimpleDN
Convenience operations for DNs.
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Get the value of the first occurrance of the argument RDN key.
E.g. Getting “OU” from “CN=Teas,OU=Are,OU=Really,DC=Awesome” results in “Are”.
Probably this only makes sense in keys like “CN” that are expected to be unique.
Sourcepub fn get_starting_from(&self, key: &str) -> Option<SimpleDN>
pub fn get_starting_from(&self, key: &str) -> Option<SimpleDN>
Like get() but returns all the RDNs starting from the asked key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SimpleDN
impl<'de> Deserialize<'de> for SimpleDN
Source§fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd for SimpleDN
Partial ordering is implemented according to DN ancestry.
I.e. A DN being “bigger” than another means that it is the ancestor of the other.
impl PartialOrd for SimpleDN
Partial ordering is implemented according to DN ancestry. I.e. A DN being “bigger” than another means that it is the ancestor of the other.
impl Eq for SimpleDN
impl StructuralPartialEq for SimpleDN
Auto Trait Implementations§
impl Freeze for SimpleDN
impl RefUnwindSafe for SimpleDN
impl Send for SimpleDN
impl Sync for SimpleDN
impl Unpin for SimpleDN
impl UnwindSafe for SimpleDN
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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