Struct salvo_extra::session::SessionHandler
source · [−]pub struct SessionHandler<S> { /* private fields */ }
session
only.Expand description
SessionHandler
Implementations
sourceimpl<S> SessionHandler<S> where
S: SessionStore,
impl<S> SessionHandler<S> where
S: SessionStore,
Sets a cookie path for this session middleware. The default for this value is “/”
sourcepub fn with_session_ttl(self, session_ttl: Option<Duration>) -> Self
pub fn with_session_ttl(self, session_ttl: Option<Duration>) -> Self
Sets a session ttl. This will be used both for the cookie expiry and also for the session-internal expiry.
The default for this value is one day. Set this to None to not set a cookie or session expiry. This is not recommended.
Sets the name of the cookie that the session is stored with or in.
If you are running multiple tide applications on the same domain, you will need different values for each application. The default value is “tide.sid”
sourcepub fn without_save_unchanged(self) -> Self
pub fn without_save_unchanged(self) -> Self
Disables the save_unchanged
setting. When save_unchanged
is enabled, a session will cookie will always be set. With
save_unchanged
disabled, the session data must be modified
from the Default
value in order for it to save. If a session
already exists and its data unmodified in the course of a
request, the session will only be persisted if
save_unchanged
is enabled.
sourcepub fn with_same_site_policy(self, policy: SameSite) -> Self
pub fn with_same_site_policy(self, policy: SameSite) -> Self
Sets the same site policy for the session cookie. Defaults to SameSite::Lax. See incrementally better cookies for more information about this setting
Sets the domain of the cookie.
Trait Implementations
sourceimpl<S: SessionStore> Debug for SessionHandler<S>
impl<S: SessionStore> Debug for SessionHandler<S>
sourceimpl<S> Handler for SessionHandler<S> where
S: SessionStore,
impl<S> Handler for SessionHandler<S> where
S: SessionStore,
sourcefn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Handle http request.
Auto Trait Implementations
impl<S> RefUnwindSafe for SessionHandler<S> where
S: RefUnwindSafe,
impl<S> Send for SessionHandler<S> where
S: Send,
impl<S> Sync for SessionHandler<S> where
S: Sync,
impl<S> Unpin for SessionHandler<S> where
S: Unpin,
impl<S> UnwindSafe for SessionHandler<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more