pub struct SimpleUser {
pub id: Uuid,
pub username: String,
pub email: String,
pub is_active: bool,
pub is_admin: bool,
pub is_staff: bool,
pub is_superuser: bool,
}Expand description
Simple user implementation with basic fields
This is a lightweight user struct suitable for most applications.
§Examples
use reinhardt_auth::{User, SimpleUser};
use uuid::Uuid;
let user = SimpleUser {
id: Uuid::new_v4(),
username: "bob".to_string(),
email: "bob@example.com".to_string(),
is_active: true,
is_admin: true,
is_staff: true,
is_superuser: false,
};
assert!(user.is_authenticated());
assert!(user.is_admin());
assert!(user.is_staff());Fields§
§id: Uuid§username: String§email: String§is_active: bool§is_admin: bool§is_staff: bool§is_superuser: boolTrait Implementations§
Source§impl Clone for SimpleUser
impl Clone for SimpleUser
Source§fn clone(&self) -> SimpleUser
fn clone(&self) -> SimpleUser
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 SimpleUser
impl Debug for SimpleUser
Source§impl<'de> Deserialize<'de> for SimpleUser
impl<'de> Deserialize<'de> for SimpleUser
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SimpleUser, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SimpleUser, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SimpleUser
impl Serialize for SimpleUser
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl User for SimpleUser
impl User for SimpleUser
Source§fn is_authenticated(&self) -> bool
fn is_authenticated(&self) -> bool
Returns whether this user is authenticated Read more
Source§fn is_superuser(&self) -> bool
fn is_superuser(&self) -> bool
Returns whether this user is a superuser Read more
Source§fn get_username(&self) -> &str
fn get_username(&self) -> &str
Returns the username (alias for
username()) Read moreAuto Trait Implementations§
impl Freeze for SimpleUser
impl RefUnwindSafe for SimpleUser
impl Send for SimpleUser
impl Sync for SimpleUser
impl Unpin for SimpleUser
impl UnsafeUnpin for SimpleUser
impl UnwindSafe for SimpleUser
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more