diff options
Diffstat (limited to 'rocie-macros/src/form/mod.rs')
| -rw-r--r-- | rocie-macros/src/form/mod.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/rocie-macros/src/form/mod.rs b/rocie-macros/src/form/mod.rs new file mode 100644 index 0000000..2719826 --- /dev/null +++ b/rocie-macros/src/form/mod.rs @@ -0,0 +1,37 @@ +use syn::{Expr, Ident, LitStr, Type}; + +mod parse; +mod generate; + +pub use generate::form_impl; + +#[derive(Debug)] +pub struct ParsedOnSubmit { + inputs: Vec<Ident>, + block: Expr, +} + +#[derive(Debug)] +pub enum ParsedChild { + Input { + name: Ident, + rust_type: Type, + html_type: LitStr, + label: LitStr, + }, + Select { + name: Ident, + label: LitStr, + rust_type: Type, + options: SelectOptions, + }, +} + +#[derive(Debug)] +pub struct SelectOptions(Vec<(LitStr, Expr)>); + +#[derive(Debug)] +pub struct ParsedInput { + on_submit: ParsedOnSubmit, + children: Vec<ParsedChild>, +} |
