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>,
pub target: Option<String>,
}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>§target: Option<String>Anchor target for navigation (GET) actions — e.g. “_blank” to open
in a new tab. When set, rel="noopener noreferrer" is added.
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
Source§impl JsonSchema for Action
impl JsonSchema for Action
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl 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