Struct nix::unistd::Group
pub struct Group {
pub name: String,
pub passwd: CString,
pub gid: Gid,
pub mem: Vec<String>,
}
The portability is definied by:
#[cfg(not(target_os = "redox"))]
Documentation
Representation of a Group, based on libc::group
Fields
pub name: String
Group name
pub passwd: CString
Group password
pub gid: Gid
Group ID
Implementations
impl Group
pub fn from_gid(gid: Gid) -> Result<Option<Self>>
Get a group by GID.
Internally, this function calls getgrgid_r(3)
Examples
use nix::unistd::{Gid, Group};
// Returns an Result<Option<Group>>, thus the double unwrap.
let res = Group::from_gid(Gid::from_raw(0)).unwrap().unwrap();
assert!(res.name == "root");
pub fn from_name(name: &str) -> Result<Option<Self>>
Get a group by name.
Internally, this function calls getgrnam_r(3)
Examples
use nix::unistd::Group;
// Returns an Result<Option<Group>>, thus the double unwrap.
let res = Group::from_name("root").unwrap().unwrap();
assert!(res.name == "root");
Trait Implementations
impl Debug for Group
fn fmt(&Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl StructuralPartialEq for Group
Auto Trait Implementations
impl RefUnwindSafe for Group
impl UnwindSafe for Group
Blanket Implementations
impl<T> BorrowMut<T> for T
where
T: ?Sized,
where
T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T