pub enum Enctype {
UrlEncoded,
Multipart,
Plain,
}Expand description
The enctype attribute values for form encoding.
§Purpose
Specifies how form data should be encoded before sending to the server, which is critical for proper handling of different types of form content.
§Usage Context
- Used with:
<form>elements (and<input>/<button>withformenctype) - Only relevant: When
method="post" - Default:
application/x-www-form-urlencoded
§Valid Values
UrlEncoded: Standard URL-encoded format (default)Multipart: Multipart form data (required for file uploads)Plain: Plain text format (rarely used, debugging only)
§Example
use ironhtml_attributes::{AttributeValue, Enctype};
let enctype = Enctype::Multipart;
assert_eq!(enctype.to_attr_value(), "multipart/form-data");<form action="/submit" method="post" enctype="application/x-www-form-urlencoded">...</form>
<form action="/upload" method="post" enctype="multipart/form-data">
<input type="file" name="document">
</form>
<form action="/feedback" method="post" enctype="text/plain">...</form>§WHATWG Specification
Variants§
UrlEncoded
URL-encoded format: application/x-www-form-urlencoded.
Default encoding for forms. Key-value pairs are URL-encoded.
Multipart
Multipart format: multipart/form-data.
Required for forms containing file uploads (<input type="file">).
Plain
Plain text format: text/plain.
Data sent as plain text. Rarely used except for debugging.
Trait Implementations§
Source§impl AttributeValue for Enctype
impl AttributeValue for Enctype
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 Enctype
impl Eq for Enctype
impl StructuralPartialEq for Enctype
Auto Trait Implementations§
impl Freeze for Enctype
impl RefUnwindSafe for Enctype
impl Send for Enctype
impl Sync for Enctype
impl Unpin for Enctype
impl UnwindSafe for Enctype
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