I hope Rust can extend function-like macros to struct members, which will make them more developer friendly. example:
// in proc-macro crate
pub struct MyStruct {}
impl MyStruct {
#[proc_macro]
pub fn parse_expr2(&mut self, arg1: TokenStream) -> TokenStream {
quote! {
my_test_func(self, #arg1)
}
}
}
// use this function-like macro
let st = MyStruct {};
let ret2 = st.parse_expr2!(1 + 2);