1 unstable release
new 0.1.1 | Feb 24, 2025 |
---|---|
0.1.0 |
|
#2020 in Network programming
14KB
101 lines
Deadpool for Ldap

Deadpool is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool3
manager for ldap3
and provides a wrapper that ensures correct use of the connection
inside a separate thread.
Features
Feature | Description | Extra dependencies | Default |
---|---|---|---|
rt_tokio_1 |
Enable support for tokio crate | deadpool/rt_tokio_1 |
yes |
rt_async-std_1 |
Enable support for async-std crate | deadpool/rt_async-std_1 |
no |
serde |
Enable support for serde crate | deadpool/serde , serde/derive |
no |
tracing |
Enable support for tracing by propagating Spans in the interact() calls. Enable this if you use the tracing crate and you want to get useful traces from within interact() calls. |
deadpool-sync/tracing , tracing |
no |
Example
use deadpool_ldap::{Config, Runtime};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let cfg = Config {
url: "ldap://127.0.0.1:389".to_string(),
bind_dn: Some("cn=admin,dc=demo,dc=com".to_string()),
bind_password: Some("123456".to_string()),
pool: None,
};
let pool = cfg.create_pool(Runtime::Tokio1).unwrap();
let mut conn = pool.get().await.unwrap();
conn.simple_bind("admin", "123456").await.unwrap();
Ok(())
}
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~7–19MB
~262K SLoC