2 ms·
Generics in Rust are supposed to be used as generics, not really for metaprogramming like this (but you can, but it won't be pleasant). But Rust has a hygenic
by Manishearth 10y ago
Generics in Rust are supposed to be used as generics, not really for metaprogramming like this (but you can, but it won't be pleasant).
But Rust has a hygenic higher-level macro system that helps.
On top of that, Rust is getting procedural macros. Right now this is limited to `#[derive()]` macros, but we want it to cover all cases. This means that you can write a macro that runs arbitrary rust code at compile time.
(While it currently is limited to `#[derive()]` macros you can abuse the API to make it work for inline bang-macros as well)