#proc-macro #validation #macro-validation

macro rod_derive

Procedural macro for the Rod Validation library

4 releases

Uses new Rust 2024

0.2.3 Sep 30, 2025
0.2.2 Sep 20, 2025
0.2.1 Sep 20, 2025
0.2.0 Sep 20, 2025

#387 in Parser tooling

Download history 103/week @ 2025-09-26 32/week @ 2025-10-03 15/week @ 2025-10-10 12/week @ 2025-10-17 3/week @ 2025-10-24

179 downloads per month
Used in rod_validation

GPL-3.0 license

115KB
2.5K SLoC

Rod Derive

Crates.io Documentation License: GPL v3

Procedural macro for the Rod Validation library. This crate provides the #[derive(RodValidate)] macro that generates validation code based on field attributes.

Overview

rod_derive is the procedural macro component of the Rod Validation framework. It automatically generates validation implementations for structs and enumerations based on declarative attributes.

This crate is typically used through the main rod_validation crate and not directly.

Usage

Add Rod Validation to your Cargo.toml:

[dependencies]
rod_validation = "0.2.2"

The derive macro is available through the prelude:

use rod_validation::prelude::*;

#[derive(RodValidate)]
struct User {
    #[rod(String {
        length: 3..=50,
        format: Email,
    })]
    email: String,
}

Documentation

For complete documentation, examples, technical details, and all supported validation attributes, see the main Rod Validation crate documentation and README.

This includes:

  • All validation types and attributes
  • Generated code details
  • Compilation guarantees
  • Performance considerations
  • Advanced features
  • Per-validation custom error messages using the ? "message" syntax
  • Limitations and troubleshooting

Dependencies

  • proc-macro2 - Token manipulation
  • quote - Code generation
  • syn - Rust syntax parsing
  • proc-macro-error - Enhanced error reporting

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Dependencies

~195–600KB
~14K SLoC