Skip to main content

output

Macro output 

Source
macro_rules! output {
    ($($tokens:tt)*) => { ... };
}
Expand description

Emit quote as token stream

Example:

output! {
    foo + bar
};

This will spit quoted TokenStream as output of the macro, just before emitting result. The format of input is the same as in quote! macro.

Note: that this is different from output_str! macro:

output_str!("foo + 2");
output! {
    "foo + 2"
};

The first will emit foo + 2 token stream (ident, punct, literal) as output of the macro. But the second one will emit "foo + 2" as string literal.