include_tt 1.1.1

Macros for ultra-flexible injection of token trees, literals, or binary data into Rust code from external files during compilation.
Documentation
use include_tt::inject;

macro_rules! test_rules {
	[
		$a:ident + $b:ident = $c:ident

		$($tt:tt)*
	] => {
		let $c = $a + $b;

		test_rules! {
			$($tt)*
		}
	};
	[
		$a:ident - $b:ident = $c:ident

		$($tt:tt)*
	] => {
		let $c = $a - $b;

		test_rules! {
			$($tt)*
		}
	};
	[ {$($tt:tt)*} ] => {
		test_rules! {
			$($tt)*
		}
	};
	[] => []
}

fn main() {
    let a = 10;
    let b = 20;

    inject! {
        // this macro only supports:
        // a + b = n
        // or
        // a - b = n
        #TRACK_FILES:
        test_rules! {
            #tt("./examples/mrules.tt") // this file contains "a + b = n", see "./for_examples/mrules.tt"
        }
    }
    assert_eq!(n, a + b);
    println!("n: {n:?}"); // 30
}