| Crates.io | |
| lib.rs | |
| version | 0.1.1 |
| created_at | 2025-12-04 19:18:54.819399+00 |
| updated_at | 2025-12-05 22:19:58.47425+00 |
| description | lightweight alternative quote |
| homepage | |
| repository | https://codeberg.org/T0mstone/qq |
| max_upload_size | |
| id | 1966901 |
| size | 79,584 |
This is an alternative to quote that doesn't rely on proc-macro2.
It also uses a slightly different syntax that allows interposing control flow and quoted code.
The basics are as follows: The QuoteExt trait contains the most immediately useful methods,
and the qq! macro converts its input tokens into a type that implements Quote (and thus QuoteExt).
A simple example:
use qq::{qq, QuoteExt};
#[proc_macro]
pub fn generate_echo(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
qq!(fn output() {
~for (i, tok) in (input.into_iter().enumerate()) {
println!(~(format!("Token {i} was {tok}")));
}
}).quote()
}
For more details, refer to the crate documentation.
These are some possible motivations for using this crate:
quote and/or proc-macro2 and were rightly horrified.quote::quote!.