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 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<S, B> Transform<S, ServiceRequest> for FlashMessagesFramework where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: MessageBody + 'static,
impl<S, B> Transform<S, ServiceRequest> for FlashMessagesFramework where
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 factory
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub 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