[][src]Macro genco::prelude::quote_in

quote_in!() { /* proc-macro */ }

Behaves the same as quote! while quoting into an existing token stream with <target> => <quoted>.

This macro takes a destination stream followed by an => and the tokens to extend that stream with.


let mut tokens = Tokens::new();
quote_in!(tokens => hello world);

quote_in! { *tokens =>
    hello...
    world!
}

Example

use genco::prelude::*;

let mut tokens = rust::Tokens::new();

quote_in! { tokens =>
    fn foo() -> u32 {
        42
    }
}

Example use inside of quote!

quote_in! can be used inside of a quote! macro by using a scope.

use genco::prelude::*;

let tokens: rust::Tokens = quote! {
    fn foo(v: bool) -> u32 {
        #(out => {
            quote_in! { *out =>
                if v {
                    1
                } else {
                    0
                }
            }
        })
    }
};

quote_in! macro.quote_in.html quote!: macro.quote.html