https://github.com/clucompany/include_tt
[stable] Macro for embedding (trees, strings, arrays) into macro trees directly from files.
https://github.com/clucompany/include_tt
clucompany code-generation code-transformation file-io macro procedural-macros
Last synced: 3 months ago
JSON representation
[stable] Macro for embedding (trees, strings, arrays) into macro trees directly from files.
- Host: GitHub
- URL: https://github.com/clucompany/include_tt
- Owner: clucompany
- License: apache-2.0
- Created: 2023-07-23T15:53:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-19T12:01:56.000Z (almost 2 years ago)
- Last Synced: 2025-03-30T09:02:02.213Z (about 1 year ago)
- Topics: clucompany, code-generation, code-transformation, file-io, macro, procedural-macros
- Language: Rust
- Homepage:
- Size: 69.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[include_tt]
(Macros for ultra-flexible injection of compiler trees, literals, or binary data into Rust syntax trees from external sources.)
[](https://github.com/clucompany/include_tt/actions/workflows/CI.yml)
## Usage
Add this to your Cargo.toml:
```toml
[dependencies]
include_tt = "1.1.0"
```
and this to your source code:
```rust
use include_tt::inject;
```
## Example
```rust
use include_tt::inject;
use std::fmt::Write;
fn main() {
let mut buf = String::new();
inject! {
write!(
&mut buf,
"Welcome, {}. Your score is {}.",
#tt("examples/name.tt"), // `"Ferris"`
#tt("examples/" "score" ".tt") // `100500`
).unwrap();
}
assert_eq!(buf, "Welcome, Ferris. Your score is 100500.");
}
```
## License
This project has a dual license according to (LICENSE-MIT) and (LICENSE-APACHE-2-0).
### Apache License
### MIT License