Skip to main content

Crate tagid_derive

Crate tagid_derive 

Source
Expand description

Provides the Label derive macro for implementing the tagid::Label trait.

§Overview

The Label derive macro automatically implements the Label trait for a given type, defining an associated Labeler type and a default labeling function.

§Example

use tagid::Label;

#[derive(Label)]
struct MyType;

The derived implementation generates:

impl tagid::Label for MyType {
    type Labeler = tagid::MakeLabeling<Self>;
    fn labeler() -> Self::Labeler { tagid::MakeLabeling::default() }
}

§Dependencies

This macro relies on the syn, quote, and proc_macro crates to parse the input, generate Rust code, and interact with the procedural macro system.

Derive Macros§

Label
Derives the Label trait for a struct or enum.