pub struct Username(/* private fields */);Available on crate feature
sys only.Expand description
System username.
This type provides type-safe system usernames following POSIX rules.
It uses the newtype pattern with #[repr(transparent)] for zero-cost abstraction.
Implementations§
Source§impl Username
impl Username
Sourcepub fn new(s: &str) -> Result<Self, UsernameError>
pub fn new(s: &str) -> Result<Self, UsernameError>
Creates a new username from a string.
§Errors
Returns an error UsernameError if the string is not a valid username.
Sourcepub const fn as_inner(&self) -> &String<32>
pub const fn as_inner(&self) -> &String<32>
Returns a reference to the underlying heapless::String.
Sourcepub fn into_inner(self) -> String<32>
pub fn into_inner(self) -> String<32>
Consumes this username and returns the underlying string.
Sourcepub fn is_system_user(&self) -> bool
pub fn is_system_user(&self) -> bool
Returns true if this is a system user.
System users typically start with underscore or are well-known system accounts.
Sourcepub fn is_service_account(&self) -> bool
pub fn is_service_account(&self) -> bool
Returns true if this is a service account.
Service accounts typically start with “svc-” or “service-”.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Username
impl<'de> Deserialize<'de> for Username
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Username
impl StructuralPartialEq for Username
Auto Trait Implementations§
impl Freeze for Username
impl RefUnwindSafe for Username
impl Send for Username
impl Sync for Username
impl Unpin for Username
impl UnwindSafe for Username
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