#[non_exhaustive]pub enum UsernameError {
Empty,
TooLong(usize),
InvalidFirstCharacter,
InvalidCharacter,
}Available on crate feature
sys only.Expand description
Error type for username parsing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Empty
Empty username
The provided string is empty. Usernames must contain at least one character.
TooLong(usize)
Username too long (max 32 characters)
According to POSIX, usernames must not exceed 32 characters. This variant contains the actual length of the provided username.
InvalidFirstCharacter
Invalid first character (must be letter or underscore)
Usernames must start with a letter (a-z, A-Z) or underscore (_). Digits and other characters are not allowed as the first character.
InvalidCharacter
Invalid character in username
Usernames can only contain ASCII letters, digits, underscores, and hyphens. This variant indicates an invalid character was found.
Trait Implementations§
Source§impl Clone for UsernameError
impl Clone for UsernameError
Source§fn clone(&self) -> UsernameError
fn clone(&self) -> UsernameError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UsernameError
impl Debug for UsernameError
Source§impl<'de> Deserialize<'de> for UsernameError
impl<'de> Deserialize<'de> for UsernameError
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
Source§impl Display for UsernameError
impl Display for UsernameError
Source§impl Error for UsernameError
Available on crate feature std only.
impl Error for UsernameError
Available on crate feature
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for UsernameError
impl PartialEq for UsernameError
Source§impl Serialize for UsernameError
impl Serialize for UsernameError
impl Copy for UsernameError
impl Eq for UsernameError
impl StructuralPartialEq for UsernameError
Auto Trait Implementations§
impl Freeze for UsernameError
impl RefUnwindSafe for UsernameError
impl Send for UsernameError
impl Sync for UsernameError
impl Unpin for UsernameError
impl UnwindSafe for UsernameError
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