Mercurial > crates > nonstick
diff src/environ.rs @ 193:5074d8e00560
Doc improvements.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 02 Aug 2025 19:49:21 -0400 |
parents | a508a69c068a |
children |
line wrap: on
line diff
--- a/src/environ.rs Sat Aug 02 19:24:12 2025 -0400 +++ b/src/environ.rs Sat Aug 02 19:49:21 2025 -0400 @@ -1,14 +1,11 @@ -//! Traits and stuff for managing the environment of a PAM handle. +//! Traits for managing the environment of a PAM handle. //! //! PAM modules can set environment variables to apply to a user session. //! This module manages the interface for doing all of that. use std::ffi::{OsStr, OsString}; -/// A key/value map for environment variables, as [`OsString`]s. -/// -/// This is a limited subset of what [`HashMap`](std::collections::HashMap) -/// can do. Notably, we do *not* support mutable iteration. +/// A read-only key/value map for environment variables, as [`OsString`]s. pub trait EnvironMap<'a> { /// Gets the environment variable of the given key. fn get(&self, key: impl AsRef<OsStr>) -> Option<OsString>; @@ -17,6 +14,10 @@ fn iter(&self) -> impl Iterator<Item = (OsString, OsString)>; } +/// A read/write key/value map for environment variables as [`OsString`]s. +/// +/// This is a limited subset of what [`HashMap`](std::collections::HashMap) +/// can do. Notably, we do *not* support mutable iteration. pub trait EnvironMapMut<'a>: EnvironMap<'a> { /// Sets the environment variable with the given key, /// returning the old one if present.