pub trait Flash:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn flash(&self, key: &str, value: Json);
fn take(&self, key: &str) -> Option<Json>;
fn peek(&self, key: &str) -> Option<Json>;
}Expand description
Somewhere a value can be left for exactly one further request.
Implemented by the session. Anything reading through this trait works
whether or not sessions are enabled — with no session, flash is a no-op
and take finds nothing, which degrades a failed form to a plain 422
rather than to a panic.
Required Methods§
Sourcefn peek(&self, key: &str) -> Option<Json>
fn peek(&self, key: &str) -> Option<Json>
Read a value and leave it in place.
A template renders the errors and the old input separately, and a page with two forms on it reads them more than once, so reading must not be what removes them. The flash lifetime does that at the end of the request instead.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".