This macro will never work:
macro_rules! foo {
($name:ident; $method:item) => (
struct $name();
impl $name {
$method
}
)
}
Instead of reinterpreting $method as an impl item, the macro expander says it was expecting const, crate, default, extern, fn, pub, type, unsafe, or }.
Moreover :item isn't good enough for parsing impl items because it doesn't have a special case for self arguments.
Is the solution to create a new :implitem or to make :item more flexible in parsing and expansion?
This macro will never work:
Instead of reinterpreting
$methodas an impl item, the macro expander says it was expectingconst,crate,default,extern,fn,pub,type,unsafe, or}.Moreover
:itemisn't good enough for parsing impl items because it doesn't have a special case forselfarguments.Is the solution to create a new
:implitemor to make:itemmore flexible in parsing and expansion?