Skip to main content

ValidateExt

Trait ValidateExt 

Source
pub trait ValidateExt: Validate + Sized {
    // Provided method
    fn validate(self) -> AutumnResult<Validated<Self>> { ... }
}
Expand description

Extension trait that adds .validate() to any type implementing validator::Validate.

Returns AutumnResult<Validated<Self>> so the ? operator works in handlers.

Provided Methods§

Source

fn validate(self) -> AutumnResult<Validated<Self>>

Validate this value and wrap it in Validated.

§Errors

Returns crate::AutumnError with status 422 and field-level error details if validation fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§