| Crates.io | tagid-derive |
| lib.rs | tagid-derive |
| version | 0.2.0 |
| created_at | 2025-02-12 04:19:26.97129+00 |
| updated_at | 2025-02-12 04:19:26.97129+00 |
| description | Defines a derive macro for the tagid newtype labeled tagging for different types of ids. |
| homepage | https://github.com/dmrolfs/tagid-rs |
| repository | https://github.com/dmrolfs/tagid-rs |
| max_upload_size | |
| id | 1552548 |
| size | 6,012 |
tagid-derive - Procedural macro for deriving Label in the tagid crateThe tagid-derive crate provides a procedural macro to derive the Label trait from the tagid crate.
This simplifies the implementation of label-based type identification.
Add the following to your Cargo.toml:
[dependencies]
tagid = "0.2"
tagid-derive = "0.2"
LabelThe Label trait provides a compile-time string label for a type.
To derive it, simply annotate your struct or enum with #[derive(Label)]:
use tagid::Label;
#[derive(Label)]
struct Order;
assert_eq!(Order::label(), "Order");
Now, Order::label() will return a unique string label for the type:
This is useful for logging, serialization, or any scenario where type-based labeling is needed.
This project is licensed under the MIT License. See LICENSE for details.