Alternative of declarative macro?

Writing declarative macro if fun, but it does not allow to parametrize neither name of functions nor associated functions.

Struct1::concat_idents!( prefix, $postfix )();

I need it to write 1k lines of tests instead of 10k, so compilation time is not as critical. Maybe exists a crate with alternative based on procedural macros which provide such parametrization?

Playground

Give paste! a try. Playground.

paste!(
    Struct1::[<prefix_ $postfix>]()
);
2 Likes

That's cool!

I was aware about the crate and tried to use, but apparently in wrong way. Thank you!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.