use rooting::{
El,
};
pub use rooting_forms_proc_macros::Form;
pub struct FormElements {
pub error: Option<El>,
pub elements: Vec<El>,
}
pub trait FormState<T> {
fn parse(&self) -> Result<T, ()>;
}
pub trait Form {
fn new_form(field: &str, from: Option<&Self>) -> (FormElements, Box<dyn FormState<Self>>);
}
pub trait FormWith<C> {
fn new_form_with(context: &C, field: &str, from: Option<&Self>) -> (FormElements, Box<dyn FormState<Self>>) {
return Self::new_form_with_(context, field, from, 0);
}
fn new_form_with_(
context: &C,
field: &str,
from: Option<&Self>,
depth: usize,
) -> (FormElements, Box<dyn FormState<Self>>);
}
impl<T: FormWith<()>> Form for T {
fn new_form(field: &str, from: Option<&Self>) -> (FormElements, Box<dyn FormState<Self>>) {
return T::new_form_with(&(), field, from);
}
}
pub mod css;
pub mod impl_str;
pub mod impl_password;
pub mod impl_bool;
pub mod impl_option;
pub mod impl_unit_structs;
pub mod impl_vec;
pub mod impl_macroutil;
#[cfg(feature = "jiff")]
pub mod impl_jiff;
pub mod republish {
pub use web_sys::HtmlSelectElement;
}