I'd like to write a macro with the shape:
macro_rules! build {
($name:ident, $mask:ty, $end:expr) => {
enum $name<K, V {
//???
}
};
}
Such that when invoked with:
build! {
Node, u64, 64
}
It expands to:
enum Node<K, V> {
Node1(u64, Box<[Node<K, V>; 1]>),
Node2(u64, Box<[Node<K, V>; 2]>),
// ...
Node64(u64, Box<[Node<K, V>; 64]>),
}
Is this possible with macro_rules
?