| Crates.io | field_names_derive |
| lib.rs | field_names_derive |
| version | 0.1.0 |
| created_at | 2026-01-15 18:23:18.422202+00 |
| updated_at | 2026-01-15 18:23:18.422202+00 |
| description | A simple procedural macro for Rust that generates field name constants for structs. Perfect for when you need compile-time field names for serialization, validation, database mapping, or configuration. |
| homepage | |
| repository | https://github.com/heart4it/field_names_derive |
| max_upload_size | |
| id | 2046266 |
| size | 21,467 |
A simple procedural macro for Rust that generates field name constants for structs. Perfect for when you need compile-time field names for serialization, validation, database mapping, or configuration.
#[derive(FieldNames)]field_names() and has_field() methodsAdd to your Cargo.toml:
[dependencies]
field_names_derive = "0.1"
use field_names_derive::FieldNames;
#[derive(FieldNames)]
struct User {
id: u64,
name: String,
}
// User::id; // "id"
Run tests:
cargo test -- --nocapture
Run example:
cargo run --bin simple_fields
Made with ❤️ for the Rust community