| Crates.io | metadata_macro |
| lib.rs | metadata_macro |
| version | 0.1.2 |
| created_at | 2025-11-26 05:43:00.917028+00 |
| updated_at | 2025-11-26 14:55:49.621759+00 |
| description | Rust macros for a very elementary metadata-like system in structs and tuple structs. |
| homepage | |
| repository | https://github.com/Ezjfc/metadata_macro |
| max_upload_size | |
| id | 1950993 |
| size | 30,856 |
Rust macros for a very elementary metadata-like system in structs and tuple structs.
This example declares a private main struct with two fields and a private metadata struct to hold the multilingual description of the fields:
use metadata_macro::metadata;
metadata!({
#[derive(Default, PartialEq, Debug)]
struct YourStruct {
field_a: bool,
field_b: usize,
}
},
#[derive(PartialEq, Debug)] struct YourStructDescription: &'static str,
);
impl Default for YourStructDescription {
fn default() -> Self {
Self {
field_a: "Describes field_a",
field_b: "Describes field_b",
}
}
}
impl YourStructDescription {
fn i18n_some_language() -> Self {
Self {
field_a: "Describes field_a in other language",
field_b: "Describes field_b in other language",
}
}
}