Macro rune_macros::quote [−][src]
quote!() { /* proc-macro */ }
Macro helper function for quoting the token stream as macro output.
Is capable of quoting everything in Rune, except for the following:
- Labels, which must be created using
Label::new
. - Dynamic quoted strings and other literals, which must be created using
Lit::new
.
Panics
Calling this macro will panic if called outside of a macro context. A macro
context can be setup using with_context
.
use rune::macros::{with_context, MacroContext}; let ctx = MacroContext::empty(); with_context(ctx, || { rune::quote!(hello self); });
Interpolating values
Values are interpolated with #value
, or #(value + 1)
for expressions.
Iterators
Anything that can be used as an iterator can be iterated over with
#(iter)*
. A token can also be used to join inbetween each iteration, like
#(iter),*
.