comparison libpam-sys/libpam-sys-helpers/src/lib.rs @ 136:efbc235f01d3

Separate libpam-sys-helpers from libpam-sys. This separates the parts of libpam-sys that don't need linking against libpam from the parts that do need to link against libpam.
author Paul Fisher <paul@pfish.zone>
date Thu, 03 Jul 2025 14:28:04 -0400
parents
children
comparison
equal deleted inserted replaced
135:b52594841480 136:efbc235f01d3
1 #![doc = include_str!("../README.md")]
2 //!
3 //! ## Current implementation
4 //!
5 //! This documentation was built based on the
6 #![doc = concat!("**", env!("LIBPAMSYS_IMPL"), "** implementation.")]
7
8 pub mod constants;
9 pub mod memory;
10
11 /// Information about the PAM implementation you're using right now.
12 ///
13 /// This module contains constants and values that can be used at build-script,
14 /// compile, and run time to determine what PAM implementation you're using.
15 ///
16 /// ## Always available
17 ///
18 /// [`PamImpl::CURRENT`] will tell you what version of PAM you're using.
19 /// It can be imported in any Rust code, from build scripts to runtime.
20 ///
21 /// ## Compile time
22 ///
23 /// Use [`enable_pam_impl_cfg`] in your `build.rs` to generate custom `#[cfg]`s
24 /// for conditional compilation based on PAM implementation.
25 ///
26 /// This will set the current `pam_impl` as well as registering all known
27 /// PAM implementations with `rustc-check-cfg` to get cfg-checking.
28 ///
29 /// The names that appear in the `cfg` variables are the same as the values
30 /// in the [`PamImpl`] enum.
31 ///
32 /// ```
33 /// #[cfg(pam_impl = "OpenPam")]
34 /// fn openpam_specific_func(handle: *const libpam_sys::pam_handle) {
35 /// let environ = libpam_sys::pam_getenvlist(handle);
36 /// // ...
37 /// libpam_sys::openpam_free_envlist()
38 /// }
39 ///
40 /// // This will give you a warning since "UnknownImpl" is not in the cfg.
41 /// #[cfg(not(pam_impl = "UnknownImpl"))]
42 /// fn do_something() {
43 /// // ...
44 /// }
45 /// ```
46 ///
47 /// The [`pam_impl_name!`] macro will expand to this same value, currently
48 #[doc = concat!("`", env!("LIBPAMSYS_IMPL"), "`.")]
49 pub mod pam_impl;
50 #[doc(inline)]
51 pub use pam_impl::*;