pub enum Method {
Get,
Post,
Dialog,
}Expand description
The method attribute values for <form> elements.
§Purpose
Specifies the HTTP method used to submit the form data to the server, controlling how data is sent and how it affects server state.
§Usage Context
- Used with:
<form>elements - Default:
getif not specified - Security: Use
postfor sensitive data or state-changing operations
§Valid Values
Get: Submit data as URL query parameters (idempotent, cacheable)Post: Submit data in request body (for state changes, sensitive data)Dialog: Close dialog and submit without HTTP request
§Example
use ironhtml_attributes::{AttributeValue, Method};
let method = Method::Post;
assert_eq!(method.to_attr_value(), "post");<form action="/search" method="get">...</form>
<form action="/login" method="post">...</form>
<form method="dialog">...</form>§WHATWG Specification
Variants§
Get
HTTP GET method. Data is appended to URL as query parameters. Use for searches, filters, and read-only operations.
Post
HTTP POST method. Data is sent in request body. Use for creating or modifying data, and for sensitive information.
Dialog
Dialog method. Closes the dialog containing the form without sending an HTTP request.
Trait Implementations§
Source§impl AttributeValue for Method
impl AttributeValue for Method
Source§fn to_attr_value(&self) -> Cow<'static, str>
fn to_attr_value(&self) -> Cow<'static, str>
Convert to the attribute value string.
impl Copy for Method
impl Eq for Method
impl StructuralPartialEq for Method
Auto Trait Implementations§
impl Freeze for Method
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnwindSafe for Method
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