pub struct User { /* private fields */ }Expand description
Represents a user account with all associated metadata.
This structure contains all the information needed to represent a user in the system, including their unique identifier, name, primary group, recorded home and hashed password with salt for security.
Implementations§
Source§impl User
impl User
Sourcepub fn new(
identifier: UserIdentifierInner,
name: String,
primary_group: GroupIdentifierInner,
home: String,
hash: String,
salt: String,
) -> Self
pub fn new( identifier: UserIdentifierInner, name: String, primary_group: GroupIdentifierInner, home: String, hash: String, salt: String, ) -> Self
Creates a new user instance with the provided information.
§Arguments
identifier- Unique numerical identifier for the username- Human-readable usernameprimary_group- Identifier of the user’s primary grouphome- Home directory recorded for the accounthash- Pre-computed SHA-512 hash of password+saltsalt- Random salt used for password hashing
Sourcepub fn get_identifier(&self) -> UserIdentifier
pub fn get_identifier(&self) -> UserIdentifier
Returns the user’s unique identifier.
Sourcepub fn get_primary_group(&self) -> GroupIdentifier
pub fn get_primary_group(&self) -> GroupIdentifier
Returns the user’s primary group identifier.
Sourcepub fn set_primary_group(&mut self, primary_group: GroupIdentifierInner)
pub fn set_primary_group(&mut self, primary_group: GroupIdentifierInner)
Updates the user’s primary group.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin for User
impl UnwindSafe for User
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more