#[derive(DeriveValidate)]
{
// Attributes available to this derive:
#[validate]
#[sensitive]
}
Expand description
Derive the Validate trait for a struct.
This macro generates an implementation of premortem::Validate that
validates all fields according to their #[validate(...)] attributes.
The generated code uses stillwater’s Validation::all() to run all
validations in parallel and accumulate ALL errors, not just the first one.
§Example
ⓘ
use premortem::Validate;
#[derive(Validate)]
struct DatabaseConfig {
#[validate(non_empty, message = "Host is required")]
host: String,
#[validate(range(1..=65535))]
port: u16,
#[validate(positive)]
pool_size: u32,
#[validate(nested)]
tls: Option<TlsConfig>,
}