Original demand: I want to implement a macro that converts Foo::*
to Bar::*
.
Pseudo code will look like this:
macro_rules! convert_foo_to_bar {
($v: ty, $p: path) => (<$v>::$p.name)
}
// convert_foo_to_bar!(Bar, Foo::A) -> Bar::A
While $p.name
refers to A
.