-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.rs
More file actions
87 lines (71 loc) · 2.37 KB
/
lib.rs
File metadata and controls
87 lines (71 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! Rust bindings to libkadm5
//!
//! This is a safe, idiomatic Rust interface to libkadm5. This crate offers two features, `client`
//! and `local`. They are similar to how kadmin-sys behaves. You should only enable one of them.
//!
//! With the `client` feature:
//!
//! ```no_run
//! use kadmin::{KAdmin, KAdminImpl};
//!
//! # #[cfg(feature = "client")]
//! # fn example() {
//! let princ = "user/admin@EXAMPLE.ORG";
//! let password = "vErYsEcUrE";
//!
//! let kadmin = KAdmin::builder().with_password(&princ, &password).unwrap();
//!
//! dbg!("{}", kadmin.list_principals(None).unwrap());
//! # }
//! ```
//!
//! With the `local` feature:
//!
//! ```no_run
//! use kadmin::{KAdmin, KAdminImpl};
//!
//! # #[cfg(feature = "local")]
//! # fn example() {
//! let kadmin = KAdmin::builder().with_local().unwrap();
//!
//! dbg!("{}", kadmin.list_principals(None).unwrap());
//! # }
//! ```
//!
//! # About thread safety
//!
//! As far as I can tell, libkadm5 APIs are **not** thread safe. As such, the types provided by this
//! crate are neither `Send` nor `Sync`. You _must not_ use those with threads. You can either
//! create a `KAdmin` instance per thread, or use the `kadmin::sync::KAdmin` interface that spawns a
//! thread and sends the various commands to it. The API is not exactly the same as the
//! non-thread-safe one, but should be close enough that switching between one or the other is
//! easy enough.
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(all(feature = "client", feature = "local", not(doc)))]
compile_error!("Feature \"client\" and feature \"local\" cannot be enabled at the same time.");
#[cfg(all(not(feature = "client"), not(feature = "local"), not(doc)))]
compile_error!("Exactly one of feature \"client\" or feature \"local\" must be selected.");
mod conv;
pub mod error;
pub use error::Error;
pub mod context;
pub use context::Context;
pub mod params;
pub use params::Params;
pub mod db_args;
pub use db_args::DbArgs;
pub mod tl_data;
pub use tl_data::{TlData, TlDataEntry};
pub mod key_data;
pub use key_data::{KeyData, KeyDataEntry};
pub mod keysalt;
pub use keysalt::{EncryptionType, KeySalt, KeySalts, SaltType};
pub mod kadmin;
pub use kadmin::{KAdmin, KAdminApiVersion, KAdminImpl, KAdminPrivileges};
pub mod sync;
pub mod policy;
pub use policy::Policy;
pub mod principal;
pub use principal::{Principal, PrincipalAttributes};
#[cfg(feature = "python")]
mod python;