pub struct StoredSession {
pub data: SessionRecord,
pub status: SessionStatus,
}Expand description
A session as stored in the database (status-agnostic).
When loading from the database, we don’t know the state at compile time.
Use the into_typed method to validate and convert to a typed session.
Fields§
§data: SessionRecord§status: SessionStatusImplementations§
Source§impl StoredSession
impl StoredSession
Sourcepub fn into_typed(self) -> LoadedSession
pub fn into_typed(self) -> LoadedSession
Convert to a typed session based on the stored status.
Sourcepub fn into_created(self) -> Result<Session<Created>, SessionStateError>
pub fn into_created(self) -> Result<Session<Created>, SessionStateError>
Try to convert to a created session.
Sourcepub fn into_active(self) -> Result<Session<Active>, SessionStateError>
pub fn into_active(self) -> Result<Session<Active>, SessionStateError>
Try to convert to an active session.
Sourcepub fn data(&self) -> &SessionRecord
pub fn data(&self) -> &SessionRecord
Get the underlying data without state validation.
Sourcepub fn status(&self) -> SessionStatus
pub fn status(&self) -> SessionStatus
Get the current status.
Trait Implementations§
Source§impl Clone for StoredSession
impl Clone for StoredSession
Source§fn clone(&self) -> StoredSession
fn clone(&self) -> StoredSession
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 StoredSession
impl Debug for StoredSession
Source§impl<'de> Deserialize<'de> for StoredSession
impl<'de> Deserialize<'de> for StoredSession
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 StoredSession
impl PartialEq for StoredSession
Source§impl Serialize for StoredSession
impl Serialize for StoredSession
impl StructuralPartialEq for StoredSession
Auto Trait Implementations§
impl Freeze for StoredSession
impl RefUnwindSafe for StoredSession
impl Send for StoredSession
impl Sync for StoredSession
impl Unpin for StoredSession
impl UnwindSafe for StoredSession
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