quote2

Crates.ioquote2
lib.rsquote2
version0.7.0
sourcesrc
created_at2023-07-01 17:50:40.223349
updated_at2023-07-04 03:59:35.33293
descriptionAn alternative lightweight version of quote
homepage
repositoryhttps://github.com/nurmohammed840/quote2
max_upload_size
id905613
size6,772
Nur (nurmohammed840)

documentation

README

An alternative lightweight version of quote.

Unlike quote, this library avoids cloning whenever possible.

Example

Add it as a dependency to your Rust project by adding the following line to your Cargo.toml file:

[dependencies]
quote2 = "0.7"
use quote2::{proc_macro2::TokenStream, quote, Quote};

let body = quote(|tokens| {
    for i in 0..3 {
        quote!(tokens, {
            println!("{}", #i);
        });
    }
});

let mut tokens = TokenStream::new();
quote!(tokens, {
    fn name() {
        #body
    }
});

Generated code:

fn name() {
    println!("{}", 0i32);
    println!("{}", 1i32);
    println!("{}", 2i32);
}
Commit count: 12

cargo fmt