Type Alias rocket::request::FlashMessage

source ·
pub type FlashMessage<'a> = Flash<&'a CookieJar<'a>>;
Expand description

Type alias to retrieve Flash messages from a request.

A FlashMessage holds the parsed contents of the flash cookie. As long as there is a flash cookie present (set by the Flash Responder), a FlashMessage request guard will succeed.

The flash cookie is cleared if either the kind() or message() method is called. If neither method is called, the flash cookie is not cleared.

Aliased Type§

struct FlashMessage<'a> { /* private fields */ }

Implementations§

source§

impl<'r> FlashMessage<'r>

source

pub fn into_inner(self) -> (String, String)

Returns a tuple of (kind, message), consuming self.

source

pub fn kind(&self) -> &str

Returns the kind of this message.

source

pub fn message(&self) -> &str

Returns the message contents of this message.

Trait Implementations§

source§

impl<'r> FromRequest<'r> for FlashMessage<'r>

Retrieves a flash message from a flash cookie. If there is no flash cookie, or if the flash cookie is malformed, an empty Err is returned.

The suggested use is through an Option and the FlashMessage type alias in request: Option<FlashMessage>.

source§

type Error = ()

The associated error to be returned if derivation fails.
source§

fn from_request<'life0, 'async_trait>( req: &'r Request<'life0>, ) -> Pin<Box<dyn Future<Output = Outcome<Self, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'r: 'async_trait, 'life0: 'async_trait,

Derives an instance of Self from the incoming request metadata. Read more
source§

impl Serialize for FlashMessage<'_>

source§

fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more