https://github.com/limpix31/t0t1
Expand macro N times for multiple generics
https://github.com/limpix31/t0t1
Last synced: 6 months ago
JSON representation
Expand macro N times for multiple generics
- Host: GitHub
- URL: https://github.com/limpix31/t0t1
- Owner: LIMPIX31
- License: apache-2.0
- Created: 2024-06-15T11:05:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-15T11:22:35.000Z (about 2 years ago)
- Last Synced: 2025-05-11T04:37:09.535Z (about 1 year ago)
- Language: Rust
- Homepage: https://crates.io/crates/toti
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# T-Zero, T-One aka toti
## Example
```rust
#[toti::expand(10)]
macro_rules! impls {
($($T:ident),+) => {
impl<$($T),+> Trait for ($($T,)+) {}
};
}
```
Expands into
```rust
impl Trait for (T0,) {}
impl Trait for (T0, T1) {}
impl Trait for (T0, T1, T2) {}
impl Trait for (T0, T1, T2, T3) {}
impl Trait for (T0, T1, T2, T3, T4) {}
impl Trait for (T0, T1, T2, T3, T4, T5) {}
impl Trait for (T0, T1, T2, T3, T4, T5, T6) {}
impl Trait for (T0, T1, T2, T3, T4, T5, T6, T7) {}
impl Trait for (T0, T1, T2, T3, T4, T5, T6, T7, T8) {}
impl Trait for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) {}
```