Struct cosworth::prelude::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§
source§impl<S, T> SessionStorage<T, S>where
T: SessionBackend<S>,
impl<S, T> SessionStorage<T, S>where
T: SessionBackend<S>,
sourcepub fn new(backend: T) -> SessionStorage<T, S>
pub fn new(backend: T) -> SessionStorage<T, S>
Create session storage
Trait Implementations§
source§impl<S, T> Middleware<S> for SessionStorage<T, S>where
S: 'static,
T: SessionBackend<S>,
impl<S, T> Middleware<S> for SessionStorage<T, S>where
S: 'static,
T: SessionBackend<S>,
source§fn start(&self, req: &HttpRequest<S>) -> Result<Started, Error>
fn start(&self, req: &HttpRequest<S>) -> Result<Started, Error>
Method is called when request is ready. It may return
future, which should resolve before next middleware get called. Read more
source§fn response(
&self,
req: &HttpRequest<S>,
resp: HttpResponse
) -> Result<Response, Error>
fn response(
&self,
req: &HttpRequest<S>,
resp: HttpResponse
) -> Result<Response, Error>
Method is called when handler returns response,
but before sending http message to peer. Read more
source§fn 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§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self
to an expression for Diesel’s query builder. Read more