Struct users::User [−][src]
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.
Methods
impl User
[src]
impl User
pub fn new<S: AsRef<OsStr> + ?Sized>(
uid: uid_t,
name: &S,
primary_group: gid_t
) -> Self
[src]
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.
pub fn uid(&self) -> uid_t
[src]
pub fn uid(&self) -> uid_t
Returns this user’s ID.
pub fn name(&self) -> &OsStr
[src]
pub fn name(&self) -> &OsStr
Returns this user’s name.
pub fn primary_group_id(&self) -> gid_t
[src]
pub fn primary_group_id(&self) -> gid_t
Returns the ID of this user’s primary group.
pub fn groups(&self) -> Option<Vec<Group>>
[src]
pub fn groups(&self) -> Option<Vec<Group>>
Returns a list of groups this user is a member of
Trait Implementations
impl UserExt for User
[src]
impl UserExt for User
fn home_dir(&self) -> &Path
[src]
fn home_dir(&self) -> &Path
Returns a path to this user’s home directory.
fn with_home_dir<S: AsRef<OsStr> + ?Sized>(self, home_dir: &S) -> Self
[src]
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
fn shell(&self) -> &Path
[src]
fn shell(&self) -> &Path
Returns a path to this user’s shell.
fn with_shell<S: AsRef<OsStr> + ?Sized>(self, shell: &S) -> Self
[src]
fn with_shell<S: AsRef<OsStr> + ?Sized>(self, shell: &S) -> Self
Sets this user’s shell path to the given string. Can be used to construct test users, which by default come with a dummy shell field. Read more
fn password(&self) -> &OsStr
[src]
fn password(&self) -> &OsStr
Returns the user’s encrypted password.
fn with_password<S: AsRef<OsStr> + ?Sized>(self, password: &S) -> Self
[src]
fn with_password<S: AsRef<OsStr> + ?Sized>(self, password: &S) -> Self
Sets this user’s password to the given string. Can be used to construct tests users, which by default come with a dummy password field. Read more
impl Clone for User
[src]
impl Clone for User
fn clone(&self) -> User
[src]
fn clone(&self) -> User
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for User
[src]
impl Debug for User