pub struct Node<T> {
pub uuid: Uuid,
pub created: DateTime<Utc>,
pub modified: DateTime<Utc>,
pub node: T,
pub name: Option<String>,
pub version: bool,
}Fields§
§uuid: Uuid§created: DateTime<Utc>§modified: DateTime<Utc>§node: T§name: Option<String>§version: boolImplementations§
Source§impl<T> Node<T>
impl<T> Node<T>
pub fn new(node: T, name: Option<String>) -> Self
pub fn new_with_uuid(uuid: Uuid, node: T, name: Option<String>) -> Self
pub fn update(&mut self, new_data: T)
pub fn set_name(&mut self, name: Option<String>)
pub fn enable_versioning(&mut self)
pub fn disable_versioning(&mut self)
pub fn is_versioning_enabled(&self) -> bool
Source§impl Node<UserData>
impl Node<UserData>
Sourcepub fn new_user(
username: String,
email: Email,
password_hash: String,
profile: Option<UserProfile>,
) -> Self
pub fn new_user( username: String, email: Email, password_hash: String, profile: Option<UserProfile>, ) -> Self
Creates a new User with UserData
Sourcepub fn password_hash(&self) -> &str
pub fn password_hash(&self) -> &str
Gets the password hash
Sourcepub fn is_verified(&self) -> bool
pub fn is_verified(&self) -> bool
Checks if user is verified
Sourcepub fn profile(&self) -> &UserProfile
pub fn profile(&self) -> &UserProfile
Gets the user profile
Sourcepub fn set_role(&mut self, role: UserRole)
pub fn set_role(&mut self, role: UserRole)
Sets the user’s role and updates the modified timestamp.
Sourcepub fn update_username(&mut self, new_username: String) -> Result<(), UserError>
pub fn update_username(&mut self, new_username: String) -> Result<(), UserError>
Updates username
Sourcepub fn update_password_hash(&mut self, new_password_hash: String)
pub fn update_password_hash(&mut self, new_password_hash: String)
Updates password hash
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivates the user
Sourcepub fn update_profile(&mut self, profile: UserProfile)
pub fn update_profile(&mut self, profile: UserProfile)
Updates the user profile
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Node<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Node<T>where
T: Deserialize<'de>,
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<T: Eq> Eq for Node<T>
Source§impl<T: Ord> Ord for Node<T>
impl<T: Ord> Ord for Node<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Node<T>
impl<T: PartialOrd> PartialOrd for Node<T>
impl<T: PartialEq> StructuralPartialEq for Node<T>
Auto Trait Implementations§
impl<T> Freeze for Node<T>where
T: Freeze,
impl<T> RefUnwindSafe for Node<T>where
T: RefUnwindSafe,
impl<T> Send for Node<T>where
T: Send,
impl<T> Sync for Node<T>where
T: Sync,
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> UnsafeUnpin for Node<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Node<T>where
T: UnwindSafe,
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.