6 个版本
| 0.2.2 | 2021 年 2 月 15 日 | 
|---|---|
| 0.2.1 | 2021 年 2 月 7 日 | 
| 0.1.0 | 2021 年 2 月 7 日 | 
#1934 在 Rust 模式
每月 21 次下载
5KB
formy
一个 derive 宏,可以将结构体生成 HTML 表单。
目前处于早期开发阶段,目前仅处理具有所有属性的输入。
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_html();
待办事项
- <select>
- <textarea>
- <button>
- <fieldset>
- <legend>
- <datalist>
- <output>
- <option>
- <optgroup>
许可证:MIT
lib.rs:
一个 derive 宏,可以将结构体生成 HTML 表单。
目前处于早期开发阶段,目前仅处理具有所有属性的输入。
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();
待办事项
- <select>
- <textarea>
- <button>
- <fieldset>
- <legend>
- <datalist>
- <output>
- <option>
- <optgroup>
依赖项
~1.5MB
~38K SLoC