Mercurial > crates > nonstick
view libpam-sys/libpam-sys-consts/src/lib.rs @ 171:e27c5c667a5a
Create full new types for return code and flags, separate end to end.
This plumbs the ReturnCode and RawFlags types through the places where
we call into or are called from PAM.
Also adds Sun documentation to the project.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Fri, 25 Jul 2025 20:52:14 -0400 |
parents | e9354e655f38 |
children |
line wrap: on
line source
pub mod constants; /// Information about the PAM implementation you're using right now. /// /// This module contains constants and values that can be used at build-script, /// compile, and run time to determine what PAM implementation you're using. /// /// ## Always available /// /// [`PamImpl::CURRENT`] will tell you what version of PAM you're using. /// It can be imported in any Rust code, from build scripts to runtime. /// /// ## Compile time /// /// Use [`enable_pam_impl_cfg`] in your `build.rs` to generate custom `#[cfg]`s /// for conditional compilation based on PAM implementation. /// /// ``` /// // Your package's build.rs: /// /// use libpam_sys_consts::pam_impl; /// // also available at libpam_sys::pam_impl /// /// fn main() { /// pam_impl::enable_pam_impl_cfg(); /// // whatever else you do in your build script. /// } /// ``` /// /// This will set the current `pam_impl` as well as registering all known /// PAM implementations with `rustc-check-cfg` to get cfg-checking. /// /// The names that appear in the `cfg` variables are the same as the values /// in the [`PamImpl`] enum. /// /// ```ignore /// #[cfg(pam_impl = "OpenPam")] /// fn openpam_specific_func(handle: *const libpam_sys::pam_handle) { /// let environ = libpam_sys::pam_getenvlist(handle); /// // ... /// libpam_sys::openpam_free_envlist() /// } /// /// // This will give you a warning since "UnknownImpl" is not in the cfg. /// #[cfg(not(pam_impl = "UnknownImpl"))] /// fn do_something() { /// // ... /// } /// ``` /// /// The [`pam_impl_name!`] macro will expand to this same value, currently #[doc = concat!("`", env!("LIBPAMSYS_IMPL"), "`.")] pub mod pam_impl; #[doc(inline)] pub use pam_impl::*;