Macro proc_macro_hack::proc_macro_expr_impl [] [src]

macro_rules! proc_macro_expr_impl {
    ($(
        $( #[$attr:meta] )*
        pub fn $func:ident($input:ident: &str) -> String $body:block
    )+) => { ... };
}

Implement a hacky procedural macro that expands to an expression.

Be careful when using this code, it's not being tested!
proc_macro_expr_impl! {
    /// Add one to an expression.
    pub fn add_one_impl(input: &str) -> String {
        format!("1 + {}", input)
    }
}