Struct highnoon::filter::session::SessionFilter
source · pub struct SessionFilter { /* private fields */ }
Expand description
A filter for implementing basic session support
This filter requires that the Context implements HasSession
Implementations
sourceimpl SessionFilter
impl SessionFilter
sourcepub fn new(store: impl SessionStore + Send + Sync + 'static) -> SessionFilter
pub fn new(store: impl SessionStore + Send + Sync + 'static) -> SessionFilter
Create a new session filter using the provided store The default cookie name is DEFAULT_COOKIE_NAME and expiry is set to one hour
Set the name of the cookie used to store the session ID
sourcepub fn with_expiry(self, expiry: Duration) -> Self
pub fn with_expiry(self, expiry: Duration) -> Self
Set the expiry time set on the session ID cookie
sourcepub fn with_callback<F>(self, callback: F) -> Selfwhere
F: Fn(&mut Cookie<'_>) + Send + Sync + 'static,
pub fn with_callback<F>(self, callback: F) -> Selfwhere
F: Fn(&mut Cookie<'_>) + Send + Sync + 'static,
Set a callback function to be used to customise the session ID cookie. The callback is called with the cookie before it is stored in the headers so you can change most settings (changing the name or value of the cookie may prevent sessions from working, so only change settings like same site, secure, etc…)
Trait Implementations
sourceimpl<S> Filter<S> for SessionFilterwhere
S: State,
S::Context: HasSession,
impl<S> Filter<S> for SessionFilterwhere
S: State,
S::Context: HasSession,
Auto Trait Implementations
impl !RefUnwindSafe for SessionFilter
impl Send for SessionFilter
impl Sync for SessionFilter
impl Unpin for SessionFilter
impl !UnwindSafe for SessionFilter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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