pub struct Session { /* private fields */ }Expand description
A cloneable handle to one server-side session.
Implementations§
Source§impl Session
impl Session
pub fn id(&self) -> String
pub fn get(&self, key: &str) -> Option<Value>
pub fn csrf_token(&self) -> Option<String>
pub fn put(&self, key: impl Into<String>, value: impl Into<Value>)
pub fn remove(&self, key: &str)
Sourcepub fn regenerate(&self)
pub fn regenerate(&self)
Replace the public session ID while preserving server-side values.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Clear all server-side values and replace the public session ID.
Sourcepub fn destroy(&self)
pub fn destroy(&self)
Permanently remove this session and expire its public cookie.
Unlike Session::invalidate, this is terminal for the current request and does not
create a replacement session. Calls to put after destroy are ignored.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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