Function pwd_grp::getgrgid

source ·
pub fn getgrgid(gid: uid_t) -> Result<Option<Group<String>>>
Expand description

Look up a group entry by gid

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::getgrgid(0).unwrap().unwrap();
assert_eq!(entry.gid, 0);