pub struct FlashMessagesFramework { /* private fields */ }
Expand description
actix-web
middleware providing support for sending and receiving FlashMessage
s.
Use FlashMessagesFramework::builder
to build an instance of FlashMessagesFramework
!
use actix_web_flash_messages::{FlashMessagesFramework, storage::CookieMessageStore};
use actix_web::{HttpServer, App, web, cookie::Key};
#[actix_web::main]
async fn main() {
let signing_key = Key::generate(); // This will usually come from configuration!
let message_store = CookieMessageStore::builder(signing_key).build();
let message_framework = FlashMessagesFramework::builder(message_store).build();
HttpServer::new(move || {
App::new()
.wrap(message_framework.clone())
// [...] your endpoints
})
}
Implementations
sourceimpl FlashMessagesFramework
impl FlashMessagesFramework
sourcepub fn builder<S: FlashMessageStore + 'static>(
storage_backend: S
) -> FlashMessagesFrameworkBuilder
pub fn builder<S: FlashMessageStore + 'static>(
storage_backend: S
) -> FlashMessagesFrameworkBuilder
A fluent API to configure FlashMessagesFramework
.
It takes as input a message store, the only required piece of configuration.
actix-web-flash-messages
provides a cookie-based implementation of flash messages, CookieMessageStore
,
using a signed cookie to store and retrieve messages.
You can provide your own custom message store backend by implementing the FlashMessageStore
trait.
Trait Implementations
sourceimpl Clone for FlashMessagesFramework
impl Clone for FlashMessagesFramework
sourcefn clone(&self) -> FlashMessagesFramework
fn clone(&self) -> FlashMessagesFramework
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<S, B> Transform<S, ServiceRequest> for FlashMessagesFrameworkwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody + 'static,
impl<S, B> Transform<S, ServiceRequest> for FlashMessagesFrameworkwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody + 'static,
type Response = ServiceResponse<B>
type Response = ServiceResponse<B>
Responses produced by the service.
type Transform = FlashMessagesMiddleware<S>
type Transform = FlashMessagesMiddleware<S>
The
TransformService
value created by this factorytype Future = Ready<Result<<FlashMessagesFramework as Transform<S, ServiceRequest>>::Transform, <FlashMessagesFramework as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<FlashMessagesFramework as Transform<S, ServiceRequest>>::Transform, <FlashMessagesFramework as Transform<S, ServiceRequest>>::InitError>>
The future response value.
sourcefn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl !RefUnwindSafe for FlashMessagesFramework
impl Send for FlashMessagesFramework
impl Sync for FlashMessagesFramework
impl Unpin for FlashMessagesFramework
impl !UnwindSafe for FlashMessagesFramework
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