include_tt

CI Mit/Apache licensed crates.io Documentation

Macro for including trees, strings, arrays from files.

```rust use includett::includett; use std::fmt::Write;

// Embedding compiler trees from a file in an arbitrary place of other macros. { let a = 10; let b = 20; let mut endstr = String::new(); includett! { let e = write!( &mut endstr,

        "arg1: {}, arg2: {}",

        // This file contains `a, b`.
        #include!("./for_examples/full.tt")
    );
}
assert_eq!(end_str, "arg1: 10, arg2: 20");

}

// Loading a string from a file. { let str = includett!( #includestr!("./forexamples/full.tt") ); asserteq!(str, "a, b"); }

// Loading an array from a file. { let array: &'static [u8; 4] = includett!( #includearr!("./forexamples/full.tt") ); asserteq!(array, b"a, b"); } ```

License

Copyright 2023 #UlinProject (Denis Kotlyarov) Денис Котляров

Licensed under the MIT License

Licensed under the Apache License, Version 2.0