Skip to main content

FormRequestDerive

Derive Macro FormRequestDerive 

Source
#[derive(FormRequestDerive)]
Expand description

Derive macro for FormRequest trait

Generates the FormRequest trait implementation for a struct. The struct must also derive serde::Deserialize and validator::Validate.

For the cleanest DX, use the #[request] attribute macro instead, which handles all derives automatically.

§Example

use ferro::{FormRequest, Deserialize, Validate};

#[derive(Deserialize, Validate, FormRequest)]
pub struct CreateUserRequest {
    #[validate(email)]
    pub email: String,

    #[validate(length(min = 8))]
    pub password: String,
}