[go: up one dir, main page]

Struct users::User [] [src]

pub struct User {
    pub name_arc: Arc<String>,
    // some fields omitted
}

Information about a particular user.

Fields

name_arc: Arc<String>

This user’s name, as an owned String possibly shared with a cache. Prefer using the name() accessor to using this field, if possible.

Methods

impl User
[src]

fn new(uid: uid_t, name: &str, primary_group: gid_t) -> User

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.

fn uid(&self) -> uid_t

Returns this user’s ID.

fn name(&self) -> &str

Returns this user’s name.

fn primary_group_id(&self) -> gid_t

Returns the ID of this user’s primary group.

Trait Implementations

impl UserExt for User
[src]

fn home_dir(&self) -> &Path

Returns a path to this user’s home directory.

fn with_home_dir(self, home_dir: &str) -> User

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

Returns a path to this user’s shell.

fn with_shell(self, shell: &str) -> User

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

impl Clone for User
[src]

fn clone(&self) -> User

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for User
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.