#[doc(alias = "form")]
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct Form {
pub data_map: crate::DataMap,
global_attrs: crate::GlobalAttributes,
pub accept_charset: std::option::Option<std::borrow::Cow<'static, str>>,
pub action: std::option::Option<std::borrow::Cow<'static, str>>,
pub autocomplete: std::option::Option<std::borrow::Cow<'static, str>>,
pub enctype: std::option::Option<std::borrow::Cow<'static, str>>,
pub method: std::option::Option<std::borrow::Cow<'static, str>>,
pub name: std::option::Option<std::borrow::Cow<'static, str>>,
pub no_validate: bool,
pub target: std::option::Option<std::borrow::Cow<'static, str>>,
pub role: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_atomic: bool,
pub aria_braille_label: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_braille_role_description: std::option::Option<
std::borrow::Cow<'static, str>,
>,
pub aria_busy: bool,
pub aria_controls_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_current: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_described_by_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_description: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_details_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_disabled: bool,
pub aria_drop_effect: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_error_message_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_flow_to_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_grabbed: bool,
pub aria_has_popup: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_hidden: bool,
pub aria_invalid: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_key_shortcuts: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_label: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_labelled_by_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_live: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_owns_elements: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_relevant: std::option::Option<std::borrow::Cow<'static, str>>,
pub aria_role_description: std::option::Option<std::borrow::Cow<'static, str>>,
}
impl crate::RenderElement for Form {
fn write_opening_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
write!(writer, "<form")?;
if let Some(field) = self.accept_charset.as_ref() {
write!(writer, r#" accept-charset="{field}""#)?;
}
if let Some(field) = self.action.as_ref() {
write!(writer, r#" action="{field}""#)?;
}
if let Some(field) = self.autocomplete.as_ref() {
write!(writer, r#" autocomplete="{field}""#)?;
}
if let Some(field) = self.enctype.as_ref() {
write!(writer, r#" enctype="{field}""#)?;
}
if let Some(field) = self.method.as_ref() {
write!(writer, r#" method="{field}""#)?;
}
if let Some(field) = self.name.as_ref() {
write!(writer, r#" name="{field}""#)?;
}
if self.no_validate {
write!(writer, r#" novalidate"#)?;
}
if let Some(field) = self.target.as_ref() {
write!(writer, r#" target="{field}""#)?;
}
if let Some(field) = self.role.as_ref() {
write!(writer, r#" role="{field}""#)?;
}
if self.aria_atomic {
write!(writer, r#" aria-atomic"#)?;
}
if let Some(field) = self.aria_braille_label.as_ref() {
write!(writer, r#" aria-braillelabel="{field}""#)?;
}
if let Some(field) = self.aria_braille_role_description.as_ref() {
write!(writer, r#" aria-brailleroledescription="{field}""#)?;
}
if self.aria_busy {
write!(writer, r#" aria-busy"#)?;
}
if let Some(field) = self.aria_controls_elements.as_ref() {
write!(writer, r#" aria-controls="{field}""#)?;
}
if let Some(field) = self.aria_current.as_ref() {
write!(writer, r#" aria-current="{field}""#)?;
}
if let Some(field) = self.aria_described_by_elements.as_ref() {
write!(writer, r#" aria-describedby="{field}""#)?;
}
if let Some(field) = self.aria_description.as_ref() {
write!(writer, r#" aria-description="{field}""#)?;
}
if let Some(field) = self.aria_details_elements.as_ref() {
write!(writer, r#" aria-details="{field}""#)?;
}
if self.aria_disabled {
write!(writer, r#" aria-disabled"#)?;
}
if let Some(field) = self.aria_drop_effect.as_ref() {
write!(writer, r#" aria-dropeffect="{field}""#)?;
}
if let Some(field) = self.aria_error_message_elements.as_ref() {
write!(writer, r#" aria-errormessage="{field}""#)?;
}
if let Some(field) = self.aria_flow_to_elements.as_ref() {
write!(writer, r#" aria-flowto="{field}""#)?;
}
if self.aria_grabbed {
write!(writer, r#" aria-grabbed"#)?;
}
if let Some(field) = self.aria_has_popup.as_ref() {
write!(writer, r#" aria-haspopup="{field}""#)?;
}
if self.aria_hidden {
write!(writer, r#" aria-hidden"#)?;
}
if let Some(field) = self.aria_invalid.as_ref() {
write!(writer, r#" aria-invalid="{field}""#)?;
}
if let Some(field) = self.aria_key_shortcuts.as_ref() {
write!(writer, r#" aria-keyshortcuts="{field}""#)?;
}
if let Some(field) = self.aria_label.as_ref() {
write!(writer, r#" aria-label="{field}""#)?;
}
if let Some(field) = self.aria_labelled_by_elements.as_ref() {
write!(writer, r#" aria-labelledby="{field}""#)?;
}
if let Some(field) = self.aria_live.as_ref() {
write!(writer, r#" aria-live="{field}""#)?;
}
if let Some(field) = self.aria_owns_elements.as_ref() {
write!(writer, r#" aria-owns="{field}""#)?;
}
if let Some(field) = self.aria_relevant.as_ref() {
write!(writer, r#" aria-relevant="{field}""#)?;
}
if let Some(field) = self.aria_role_description.as_ref() {
write!(writer, r#" aria-roledescription="{field}""#)?;
}
write!(writer, "{}", self.global_attrs)?;
write!(writer, "{}", self.data_map)?;
write!(writer, ">")?;
Ok(())
}
#[allow(unused_variables)]
fn write_closing_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
write!(writer, "</form>")?;
Ok(())
}
}
impl std::fmt::Display for Form {
fn fmt(&self, writer: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use crate::RenderElement;
self.write_opening_tag(writer)?;
self.write_closing_tag(writer)?;
Ok(())
}
}
impl std::ops::Deref for Form {
type Target = crate::GlobalAttributes;
fn deref(&self) -> &Self::Target {
&self.global_attrs
}
}
impl std::ops::DerefMut for Form {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.global_attrs
}
}