Struct ldap3::LdapConnAsync [−][src]
Asynchronous connection to an LDAP server. *
In this version of the interface, opening a connection with new()
will return a tuple consisting of the connection itself and an Ldap
handle for performing the LDAP operations. The connection must be spawned on the active
Tokio executor before using the handle. A convenience macro, drive!
, is
provided by the library. For the connection conn
, it does the equivalent of:
tokio::spawn(async move { if let Err(e) = conn.drive().await { warn!("LDAP connection error: {}", e); } });
If you need custom connection lifecycle handling, use the drive()
method
on the connection inside your own async
block.
The Ldap
handle can be freely cloned, with each clone capable of launching a separate
LDAP operation multiplexed on the original connection. Dropping the last handle will automatically
close the connection.
Some connections need additional parameters, but providing many separate functions to initialize
them, singly or in combination, would result in a cumbersome interface. Instead, connection
initialization is optimized for the expected most frequent usage, and additional customization
is possible through the LdapConnSettings
struct, which can be
passed to with_settings()
.
Implementations
impl LdapConnAsync
[src]
pub async fn with_settings(
settings: LdapConnSettings,
url: &str
) -> Result<(Self, Ldap)>
[src]
settings: LdapConnSettings,
url: &str
) -> Result<(Self, Ldap)>
Open a connection to an LDAP server specified by url
, using
settings
to specify additional parameters.
pub async fn new(url: &str) -> Result<(Self, Ldap)>
[src]
Open a connection to an LDAP server specified by url
.
The url
is an LDAP URL. Depending on the platform and compile-time features, the
library will recognize one or more URL schemes.
The ldap scheme, which uses a plain TCP connection, is always available. Unix-like platforms also support ldapi, using Unix domain sockets. With the tls or tls-rustls feature, the ldaps scheme and StartTLS over ldap are additionally supported.
The connection element in the returned tuple must be spawned on the current Tokio
executor before using the Ldap
element. See the introduction to this struct’s
documentation.
pub async fn from_url_with_settings(
settings: LdapConnSettings,
url: &Url
) -> Result<(Self, Ldap)>
[src]
settings: LdapConnSettings,
url: &Url
) -> Result<(Self, Ldap)>
Open a connection to an LDAP server specified by an already parsed Url
, using
settings
to specify additional parameters.
pub async fn from_url(url: &Url) -> Result<(Self, Ldap)>
[src]
Open a connection to an LDAP server specified by an already parsed Url
.
pub async fn drive(self) -> Result<()>
[src]
Repeatedly poll the connection until it exits.
Auto Trait Implementations
impl !RefUnwindSafe for LdapConnAsync
impl Send for LdapConnAsync
impl Sync for LdapConnAsync
impl Unpin for LdapConnAsync
impl !UnwindSafe for LdapConnAsync
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,