pub struct Outcome { /* private fields */ }Expand description
What an Action or a HeaderAction asks of the
response once its write commits: which notification it flashes and where it lands.
Outcome::done keeps the defaults: the action’s success
notification, landing back where the action ran from. A run builds on it:
// Report what happened, and open the copy the action made.
let outcome = Outcome::done()
.notify(
Notification::warning(format!("{sent} sent")).description(format!("{bounced} bounced")),
)
.redirect(format!("/admin/invoices/{id}"));A file to download is a redirect to an app route that serves it.
Implementations§
Source§impl Outcome
impl Outcome
Sourcepub fn done() -> Self
pub fn done() -> Self
The defaults: the action’s success notification, landing where it ran from.
Sourcepub fn notify(self, notification: Notification) -> Self
pub fn notify(self, notification: Notification) -> Self
Flashes notification instead of the action’s success notification. A bulk run that
skipped records appends their count to its title.
Sourcepub fn redirect(self, path: impl Into<String>) -> Self
pub fn redirect(self, path: impl Into<String>) -> Self
Lands on path instead of where the action ran from. path is a same-origin path such
as /admin/invoices/42; anything else, such as https://… or //host, lands where the
action ran from and logs an error, since the write has already committed.