pub struct StoredLock {
pub data: LockRecord,
pub is_active: bool,
}Expand description
A lock as stored in the database (status-agnostic).
When loading from the database, we don’t know the state at compile time.
Use the into_acquired method to validate and convert to a typed lock.
Fields§
§data: LockRecord§is_active: boolWhether this lock is currently active (not expired/released)
Implementations§
Source§impl StoredLock
impl StoredLock
Sourcepub fn into_acquired(
self,
now: Timestamp,
) -> Result<Lock<Acquired>, LockStateError>
pub fn into_acquired( self, now: Timestamp, ) -> Result<Lock<Acquired>, LockStateError>
Convert to an acquired lock if the lock is active and not expired.
§Errors
Returns Err if the lock is not active or has expired.
Sourcepub fn data(&self) -> &LockRecord
pub fn data(&self) -> &LockRecord
Get the underlying data without state validation.
Trait Implementations§
Source§impl Clone for StoredLock
impl Clone for StoredLock
Source§fn clone(&self) -> StoredLock
fn clone(&self) -> StoredLock
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 StoredLock
impl Debug for StoredLock
Source§impl<'de> Deserialize<'de> for StoredLock
impl<'de> Deserialize<'de> for StoredLock
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 PartialEq for StoredLock
impl PartialEq for StoredLock
Source§impl Serialize for StoredLock
impl Serialize for StoredLock
impl StructuralPartialEq for StoredLock
Auto Trait Implementations§
impl Freeze for StoredLock
impl RefUnwindSafe for StoredLock
impl Send for StoredLock
impl Sync for StoredLock
impl Unpin for StoredLock
impl UnwindSafe for StoredLock
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