Skip to main content

validate

Macro validate 

Source
validate!() { /* proc-macro */ }
Expand description

Adds field validations to a changeset, in the syntax of the model’s #[validate(…)] attributes: for named changesets, whose rules differ from one form to another.

ⓘ
pub fn signup(params: &Params) -> Changeset<User> {
    let changeset = User::changeset()
        .cast(|u| u.email, params)
        .cast(|u| u.password, params);
    glacier::validate!(changeset, password, required, length = 8..)
}

Field validations on a changeset, in the #[validate(…)] syntax; see glacier::validate!.