1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//! A derive macro to generate HTML forms from structs. //! //! Currently in early development, only input with all its attributes is handled right now. //! //! Docs: https://docs.rs/formy/ //! //! ```rust //! use formy::Form; //! //! #[derive(Form)] //! struct UserLogin { //! #[input(pattern = r"[\w]+")] //! #[label = "Username:"] //! username: String, //! #[input(type = "email", name = "real_email", class="py-4", id = "email")] //! email: String, //! #[input(type = "password")] //! #[label = "Password:"] //! password: String, //! some_field: String, //! } //! //! let form = UserLogin::to_form(); //! ``` //! //! ## TODO: //! //! - [ ] \<select> //! - [ ] \<textarea> //! - [ ] \<button> //! - [ ] \<fieldset> //! - [ ] \<legend> //! - [ ] \<datalist> //! - [ ] \<output> //! - [ ] \<option> //! - [ ] \<optgroup> /// The derive macro. pub use formy_derive::Form; /// A trait for structs which can be parsed into a html form. pub trait Form { /// Returns the form representation of this struct. fn to_form() -> String; }