pub struct Passwd {
pub name: String,
pub uid: u32,
pub gid: u32,
pub user_info: String,
pub user_shell: String,
pub user_dir: String,
pub user_passwd: String,
}
Fields
name: String
AKA passwd.pw_name
uid: u32
AKA passwd.pw_uid
gid: u32
AKA passwd.pw_gid
user_info: String
AKA passwd.pw_gecos
user_shell: String
AKA passwd.pw_shell
user_dir: String
AKA passwd.pw_dir
user_passwd: String
AKA passwd.pw_passwd
Implementations
sourceimpl Passwd
impl Passwd
sourcepub fn belongs_to(&self) -> Vec<u32, Global>
pub fn belongs_to(&self) -> Vec<u32, Global>
This is a wrapper function for libc::getgrouplist
.
From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>
If the number of groups of which user is a member is less than or equal to *ngroups, then the value *ngroups is returned. If the user is a member of more than *ngroups groups, then getgrouplist() returns -1. In this case, the value returned in *ngroups can be used to resize the buffer passed to a further call getgrouplist().
However, on macOS/darwin (and maybe others?) getgrouplist
does
not update ngroups
if ngroups
is too small. Therefore, if not
updated by getgrouplist
, ngroups
needs to be increased in a
loop until getgrouplist
stops returning -1.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Passwd
impl Send for Passwd
impl Sync for Passwd
impl Unpin for Passwd
impl UnwindSafe for Passwd
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more