pub struct Action {
pub handler: String,
pub url: Option<String>,
pub method: HttpMethod,
pub confirm: Option<ConfirmDialog>,
pub on_success: Option<ActionOutcome>,
pub on_error: Option<ActionOutcome>,
}Expand description
An action declaration mapping a user interaction to a backend handler.
Fields§
§handler: StringHandler reference in “controller.method” format.
url: Option<String>Resolved URL for this action. Populated by the resolver at render time.
method: HttpMethod§confirm: Option<ConfirmDialog>§on_success: Option<ActionOutcome>§on_error: Option<ActionOutcome>Implementations§
Source§impl Action
impl Action
Sourcepub fn new(handler: impl Into<String>) -> Self
pub fn new(handler: impl Into<String>) -> Self
Create an action with Post method (the default for form submissions).
Sourcepub fn method(self, method: HttpMethod) -> Self
pub fn method(self, method: HttpMethod) -> Self
Override the HTTP method.
Sourcepub fn confirm_danger(self, title: impl Into<String>) -> Self
pub fn confirm_danger(self, title: impl Into<String>) -> Self
Add a danger confirmation dialog.
Sourcepub fn on_success(self, outcome: ActionOutcome) -> Self
pub fn on_success(self, outcome: ActionOutcome) -> Self
Set the success outcome.
Sourcepub fn on_error(self, outcome: ActionOutcome) -> Self
pub fn on_error(self, outcome: ActionOutcome) -> Self
Set the error outcome.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more