pub struct SessionStore { /* private fields */ }Expand description
Thread-safe storage for sessions.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn create(&self) -> Result<SessionId>
pub fn create(&self) -> Result<SessionId>
Create a new session.
Returns the newly assigned session ID.
Sourcepub fn get(&self, id: &SessionId) -> Result<Option<Session>>
pub fn get(&self, id: &SessionId) -> Result<Option<Session>>
Get a clone of the session with the given ID.
Sourcepub fn update<F>(&self, id: &SessionId, f: F) -> Result<()>
pub fn update<F>(&self, id: &SessionId, f: F) -> Result<()>
Update a session using a closure.
The closure receives a mutable reference to the session and can modify it. Returns an error if the session doesn’t exist.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl UnwindSafe for SessionStore
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