Registry / other / validator-derive

validator-derive

JSON →
library0.20.0rscratesunverified

Proc-macro derive for the Validate trait, enabling automatic validation of struct fields.

# Cargo.toml [dependencies] validator_derive = "0.20.0"
INSTALL
IMPORT
SIG · VALIDATOR-DERIVE
V
validator-derive
otherrustv0.20.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Validate
use validator_derive::Validate;

Derive validation for struct fields using validator attributes.

use validator_derive::Validate; #[derive(Validate)] struct User { #[validate(email)] email: String, } fn main() { let user = User { email: "invalid".into() }; match user.validate() { Ok(_) => println!("Valid"), Err(e) => println!("Validation error: {}", e), } }
Debug
Known issues
gotchaRequires the `validator` crate for runtime validation logic.
fix
Add `validator = "0.20"` to your dependencies.
affects: >=0.20.0
Upgrade
Version history
0.20.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
validator-derive — cargo add validator-derive · libregistry