Expand description
Information about a particular user.
Fields§
§name_arc: Arc<OsString>
This user’s name, as an owned OsString
possibly shared with a cache.
Prefer using the name()
accessor to using this field, if possible.
Implementations§
source§impl User
impl User
sourcepub fn new<S: AsRef<OsStr> + ?Sized>(
uid: uid_t,
name: &S,
primary_group: gid_t
) -> Self
pub fn new<S: AsRef<OsStr> + ?Sized>(
uid: uid_t,
name: &S,
primary_group: gid_t
) -> Self
Create a new User
with the given user ID, name, and primary
group ID, with the rest of the fields filled with dummy values.
This method does not actually create a new user on the system—it should only be used for comparing users in tests.
sourcepub fn primary_group_id(&self) -> gid_t
pub fn primary_group_id(&self) -> gid_t
Returns the ID of this user’s primary group.
Trait Implementations§
source§impl UserExt for User
impl UserExt for User
source§fn with_home_dir<S: AsRef<OsStr> + ?Sized>(self, home_dir: &S) -> Self
fn with_home_dir<S: AsRef<OsStr> + ?Sized>(self, home_dir: &S) -> Self
Sets this user value’s home directory to the given string.
Can be used to construct test users, which by default come with a
dummy home directory string. Read more