Struct users::User [−][src]
Information about a particular user.
For more information, see the module documentation.
Implementations
impl User
[src]
pub fn new<S: AsRef<OsStr> + ?Sized>(
uid: uid_t,
name: &S,
primary_group: gid_t
) -> Self
[src]
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.
Examples
use users::User; let user = User::new(501, "stevedore", 100);
pub fn uid(&self) -> uid_t
[src]
Returns this user’s ID.
Examples
use users::User; let user = User::new(501, "stevedore", 100); assert_eq!(user.uid(), 501);
pub fn name(&self) -> &OsStr
[src]
Returns this user’s name.
Examples
use std::ffi::OsStr; use users::User; let user = User::new(501, "stevedore", 100); assert_eq!(user.name(), OsStr::new("stevedore"));
pub fn primary_group_id(&self) -> gid_t
[src]
Returns the ID of this user’s primary group.
Examples
use users::User; let user = User::new(501, "stevedore", 100); assert_eq!(user.primary_group_id(), 100);
pub fn groups(&self) -> Option<Vec<Group>>
[src]
Returns a list of groups this user is a member of. This involves loading the groups list, as it is not contained within this type.
libc functions used
Examples
use users::User; let user = User::new(501, "stevedore", 100); for group in user.groups().expect("User not found") { println!("User is in group: {:?}", group.name()); }
Trait Implementations
impl Clone for User
[src]
impl Debug for User
[src]
impl UserExt for User
[src]
fn home_dir(&self) -> &Path
[src]
fn with_home_dir<S: AsRef<OsStr> + ?Sized>(self, home_dir: &S) -> Self
[src]
fn shell(&self) -> &Path
[src]
fn with_shell<S: AsRef<OsStr> + ?Sized>(self, shell: &S) -> Self
[src]
fn password(&self) -> &OsStr
[src]
fn with_password<S: AsRef<OsStr> + ?Sized>(self, password: &S) -> Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,