pub struct SessionManager { /* private fields */ }Expand description
The application’s session store and settings.
This is what the container holds and what the Session facade resolves.
It is not a request’s session. A facade is process-global and a session
belongs to one request, so there is nothing honest for
Session::instance().get("user_id") to return. Per-request access is
request.session(); this type is for
the operations that genuinely are application-wide — reading or destroying
a session by id, and collecting expired ones.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(store: Arc<dyn SessionStore>) -> Self
pub fn new(store: Arc<dyn SessionStore>) -> Self
A manager over store, with the default cookie settings.
Sourcepub fn with_config(store: Arc<dyn SessionStore>, config: SessionConfig) -> Self
pub fn with_config(store: Arc<dyn SessionStore>, config: SessionConfig) -> Self
A manager with explicit settings.
Sourcepub fn configure(
self,
adjust: impl FnOnce(SessionConfig) -> SessionConfig,
) -> Self
pub fn configure( self, adjust: impl FnOnce(SessionConfig) -> SessionConfig, ) -> Self
Adjust the settings.
Sourcepub fn store(&self) -> &Arc<dyn SessionStore> ⓘ
pub fn store(&self) -> &Arc<dyn SessionStore> ⓘ
The store.
Sourcepub fn config(&self) -> &SessionConfig
pub fn config(&self) -> &SessionConfig
The cookie settings.
Sourcepub async fn read(&self, id: &str) -> Result<Option<SessionData>>
pub async fn read(&self, id: &str) -> Result<Option<SessionData>>
Read a session by id, without a request.
For an administrative view: “what is in this user’s session”.
Trait Implementations§
Source§impl Clone for SessionManager
impl Clone 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.