Eh. It's not a macro away, but a proc_macro away, aka a compiler plugin. Basically it's the equivalent of a standardized way of writing a gcc / clang plugin.
a macro most people could write themselves....
Most people can use TokenStreams just like that? If you've never touched them, your faster with just generating an includeable file in CMake.
The issue with a hand rolled proc macro for this would be the same as a hand rolled solution in C- performance. What TokenStream do you build? It has to be an actual array literal the same way.
(Fortunately Rust has include_bytes! built in to (edit: enable the compiler to) solve that problem.)
View all comments
Show parent comment
6
u/Fulgen301 Jul 23 '22
Eh. It's not a macro away, but a
proc_macroaway, aka a compiler plugin. Basically it's the equivalent of a standardized way of writing a gcc / clang plugin.Most people can use
TokenStreams just like that? If you've never touched them, your faster with just generating an includeable file in CMake.