pub fn getpwnam(name: impl AsRef<str>) -> Result<Option<Passwd<String>>>
Expand description
Look up a passwd entry by name
Returns None
if the entry isn’t found,
or Err
if an error occurred.
If the entry contains strings that aren’t valid UTF-8,
this is treated as an error.
If you need to handle non-UTF-8 password/group entries,
use the generic trait methods on PwdGrp
.
Example
let entry = pwd_grp::getpwnam("root").unwrap().unwrap();
assert_eq!(entry.uid, 0);