wtf
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
wtforms_derive
.gitignore
Cargo.toml
LICENSE
README.md

README.md

wtforms

NOTE it doesn't work yet

As the name implies, it's heavily inspired by the Python library wtforms.

Usage

#[derive(Form, Serialize, Deserialize)]
struct RegisterForm {
    pub email: Email,
    #[validators(required, length(5, 10))]
    pub username: String,
    pub password: Password,
    #[validators(equal_to("self.password"))]
    pub confirm_password: Password,
}

Then you can RegisterForm::as_html() to generate HTML code for it.

You can also validate a RegisterForm that's been deserialized from, for example Form<RegisterForm> in some web framework.

Caveats

Customization not supported yet.

Contact

Author: Michael Zhang

License: MIT