Struct actix_web::middleware::session::SessionStorage
source · pub struct SessionStorage<T, S>(_, _);
Expand description
Session storage middleware
use actix_web::middleware::session::{CookieSessionBackend, SessionStorage};
use actix_web::App;
fn main() {
let app = App::new().middleware(SessionStorage::new(
// <- create session middleware
CookieSessionBackend::signed(&[0; 32]) // <- create cookie session backend
.secure(false),
));
}
Implementations
sourceimpl<S, T: SessionBackend<S>> SessionStorage<T, S>
impl<S, T: SessionBackend<S>> SessionStorage<T, S>
sourcepub fn new(backend: T) -> SessionStorage<T, S>
pub fn new(backend: T) -> SessionStorage<T, S>
Create session storage
Trait Implementations
sourceimpl<S: 'static, T: SessionBackend<S>> Middleware<S> for SessionStorage<T, S>
impl<S: 'static, T: SessionBackend<S>> Middleware<S> for SessionStorage<T, S>
sourcefn start(&self, req: &HttpRequest<S>) -> Result<Started>
fn start(&self, req: &HttpRequest<S>) -> Result<Started>
Method is called when request is ready. It may return
future, which should resolve before next middleware get called. Read more
sourcefn response(&self, req: &HttpRequest<S>, resp: HttpResponse) -> Result<Response>
fn response(&self, req: &HttpRequest<S>, resp: HttpResponse) -> Result<Response>
Method is called when handler returns response,
but before sending http message to peer. Read more
sourcefn finish(&self, req: &HttpRequest<S>, resp: &HttpResponse) -> Finished
fn finish(&self, req: &HttpRequest<S>, resp: &HttpResponse) -> Finished
Method is called after body stream get sent to peer.
Auto Trait Implementations
impl<T, S> RefUnwindSafe for SessionStorage<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for SessionStorage<T, S>where
S: Send,
T: Send,
impl<T, S> Sync for SessionStorage<T, S>where
S: Sync,
T: Sync,
impl<T, S> Unpin for SessionStorage<T, S>where
S: Unpin,
T: Unpin,
impl<T, S> UnwindSafe for SessionStorage<T, S>where
S: UnwindSafe,
T: UnwindSafe,
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