field-meta
A Rust procedural macro that provides compile-time field metadata access for structs.
Overview
field-meta is a derive macro that automatically generates methods to introspect struct fields at compile time. It allows you to:
- Get a list of all field names in a struct
- Check if a field exists by name
- Count the number of fields
- Optionally skip fields from being included in metadata
Installation
Add this to your Cargo.toml:
[]
= "0.1.1"
Usage
Basic Example
use FieldMeta;
Skipping Fields
You can exclude fields from the metadata using the #[field_meta(skip)] attribute:
use FieldMeta;
Field Aliases
Use #[field_meta(alias = "...")] to create an alias that contains_field() will recognize:
use FieldMeta;
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.