comparison libpam-sys/libpam-sys-consts/src/lib.rs @ 148:4b3a5095f68c

Move libpam-sys helpers into their own library. - Renames libpam-sys-helpers to libpam-sys-consts. - Moves libpam-sys-helpers::helpers into libpam-sys-helpers, which moves them completely out of libpam-sys's dependency chain. - Moves the aliases from libpam-sys into libpam-sys::aliases.
author Paul Fisher <paul@pfish.zone>
date Mon, 07 Jul 2025 12:11:43 -0400
parents libpam-sys/libpam-sys-helpers/src/memory.rs@ebb71a412b58
children ab8020566cd9
comparison
equal deleted inserted replaced
147:4d7333337569 148:4b3a5095f68c
1 pub mod constants;
2
3 /// Information about the PAM implementation you're using right now.
4 ///
5 /// This module contains constants and values that can be used at build-script,
6 /// compile, and run time to determine what PAM implementation you're using.
7 ///
8 /// ## Always available
9 ///
10 /// [`PamImpl::CURRENT`] will tell you what version of PAM you're using.
11 /// It can be imported in any Rust code, from build scripts to runtime.
12 ///
13 /// ## Compile time
14 ///
15 /// Use [`enable_pam_impl_cfg`] in your `build.rs` to generate custom `#[cfg]`s
16 /// for conditional compilation based on PAM implementation.
17 ///
18 /// This will set the current `pam_impl` as well as registering all known
19 /// PAM implementations with `rustc-check-cfg` to get cfg-checking.
20 ///
21 /// The names that appear in the `cfg` variables are the same as the values
22 /// in the [`PamImpl`] enum.
23 ///
24 /// ```
25 /// #[cfg(pam_impl = "OpenPam")]
26 /// fn openpam_specific_func(handle: *const libpam_sys::pam_handle) {
27 /// let environ = libpam_sys::pam_getenvlist(handle);
28 /// // ...
29 /// libpam_sys::openpam_free_envlist()
30 /// }
31 ///
32 /// // This will give you a warning since "UnknownImpl" is not in the cfg.
33 /// #[cfg(not(pam_impl = "UnknownImpl"))]
34 /// fn do_something() {
35 /// // ...
36 /// }
37 /// ```
38 ///
39 /// The [`pam_impl_name!`] macro will expand to this same value, currently
40 #[doc = concat!("`", env!("LIBPAMSYS_IMPL"), "`.")]
41 pub mod pam_impl;
42
43 #[doc(inline)]
44 pub use pam_impl::*;