Skip to main content

Crate tatara_rust_macro_rules

Crate tatara_rust_macro_rules 

Source
Expand description

tatara-rust-macro-rules — L2 authoring surface for declarative macros.

One typed MacroRulesSpec value → one normal library crate that exposes pub macro_rules! my_macro { … }. No proc-macro plumbing required; this is a [lib] not a [lib] proc-macro = true.

Each arm carries raw matcher + transcriber token text. Authoring shape:

use tatara_rust_ast::{CompileToCrate, Ident};
use tatara_rust_macro_rules::{MacroArm, MacroRulesSpec};

let spec = MacroRulesSpec {
    macro_name: Ident::new("my_vec"),
    arms: vec![MacroArm {
        matcher: "( $($e:expr),* $(,)? )".into(),
        transcriber: "{ ::std::vec![ $($e),* ] }".into(),
    }],
};
let scaffold = spec.compile_to_crate("my-vec-macros").unwrap();

Structs§

MacroArm
MacroRulesSpec