pub struct SessionManager { /* private fields */ }Expand description
Loads and stores the session around every request.
Cheap to clone; the clone shares one store.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(key: &AppKey, store: impl SessionStore) -> Self
pub fn new(key: &AppKey, store: impl SessionStore) -> Self
Build with an explicit key and store.
Sourcepub fn from_config(config: &Config, store: impl SessionStore) -> Result<Self>
pub fn from_config(config: &Config, store: impl SessionStore) -> Result<Self>
Build from configuration: app.key, session.cookie, session.lifetime.
The store keeps its own lifetime — build it with
SessionManager::lifetime_from_config so the cookie and the stored
session expire together.
Sourcepub fn lifetime_from_config(config: &Config) -> Duration
pub fn lifetime_from_config(config: &Config) -> Duration
session.lifetime, in minutes, as Laravel writes it.
pub fn lifetime(self, lifetime: Duration) -> Self
pub fn path(self, path: impl Into<String>) -> Self
Sourcepub fn secure(self, secure: bool) -> Self
pub fn secure(self, secure: bool) -> Self
Mark the cookie Secure, so browsers only send it over HTTPS.
pub fn same_site(self, same_site: SameSite) -> Self
pub fn store(&self) -> &SharedStore
Trait Implementations§
Source§impl Clone for SessionManager
impl Clone for SessionManager
Source§fn clone(&self) -> SessionManager
fn clone(&self) -> SessionManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SessionManager
impl Debug for SessionManager
Auto Trait Implementations§
impl !RefUnwindSafe for SessionManager
impl !UnwindSafe for SessionManager
impl Freeze for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
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