metadata_macro

Crates.iometadata_macro
lib.rsmetadata_macro
version0.1.2
created_at2025-11-26 05:43:00.917028+00
updated_at2025-11-26 14:55:49.621759+00
descriptionRust macros for a very elementary metadata-like system in structs and tuple structs.
homepage
repositoryhttps://github.com/Ezjfc/metadata_macro
max_upload_size
id1950993
size30,856
EndermanbugZJFC (Ezjfc)

documentation

README

Metadata Macro

Rust macros for a very elementary metadata-like system in structs and tuple structs.

Crates.io Version docs.rs

Examples

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",
        }
    }
}
Commit count: 0

cargo fmt