Skip to main content

Module rules

Module rules 

Source
Expand description

Built-in validation rules for Rusdantic.

Each rule module provides a validation function that the derive macro’s generated code calls at runtime. All functions follow a consistent pattern: they take the value to validate, constraint parameters, the field path, and a mutable reference to a ValidationErrors collection.

This design allows error accumulation (collect-all) rather than fail-fast behavior.

Re-exports§

pub use contains::validate_contains;
pub use email::validate_email;
pub use length::validate_length;
pub use pattern::validate_pattern;
pub use range::validate_range;
pub use required::validate_required;
pub use url::validate_url;

Modules§

contains
String contains validation rule.
email
Email format validation rule.
length
Length validation rule.
pattern
Regex pattern validation rule.
range
Numeric range validation rule.
required
Required field validation rule.
url
URL format validation rule.

Traits§

AsStr
Trait for types that can be checked against a string pattern. Used by email, url, pattern, and contains validators.
HasLength
Trait for types that have a measurable length. Used by the length validator to work with both strings and collections.