pub struct CCashUser { /* private fields */ }
Expand description
User struct that can be used for authentication purposes.
Implementations§
Source§impl CCashUser
impl CCashUser
Sourcepub fn new(username: &str, password: &str) -> Result<Self, CCashUsernameError>
pub fn new(username: &str, password: &str) -> Result<Self, CCashUsernameError>
Creates a new user where the username is checked against CCash
’s
requirements. This is the recommended way to create a CCashUser
as
it is guaranteed to not cause CCash
to reject the username. username
will automatically be made lowercase.
§Errors
- Returns
CCashUsernameError::NameTooShort
if givenusername
is shorter than 3 characters. - Returns
CCashUsernameError::NameTooLong
if givenusername
is longer than 16 characters. - Returns
CCashUsernameError::NameContainsInvalidCharacters
if givenusername
otherwise contains invalid characters such as spaces.
Sourcepub fn new_unchecked(username: &str, password: &str) -> Self
pub fn new_unchecked(username: &str, password: &str) -> Self
Creates a new CCashUser
with an unchecked username against CCash
’s
requirements. This method is not recommended as it could cause
hard-to-diagnose or confusing errors from CCash
for the user.
Sourcepub fn get_username(&self) -> &str
pub fn get_username(&self) -> &str
Returns an immutable reference to the CCashUser
’s username.
Sourcepub fn get_password(&self) -> &str
pub fn get_password(&self) -> &str
Returns an immutable reference to the CCashUser
’s password.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CCashUser
impl<'de> Deserialize<'de> for CCashUser
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 CCashUser
impl StructuralPartialEq for CCashUser
Auto Trait Implementations§
impl Freeze for CCashUser
impl RefUnwindSafe for CCashUser
impl Send for CCashUser
impl Sync for CCashUser
impl Unpin for CCashUser
impl UnwindSafe for CCashUser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.