I have a function which is called quite frequently which needs the letters of the alphabet in a vector.
To do so during runtime es quite easy:
let alphabet = (b'a'..b'z').map(|c| c as char).map(|c| c.to_string());
// Do some stuff with the alphabet...
Ok one can create another function creating this alphabet and then applying memorization on top of it...
...but I have heard that rust has a powerful macro feature.
How to create this vector - or maybe better a fixed size array with items of type str
- during compile-time?
In other words I do want to have something like this
const alphabet: [&'static str; 26] = ["a", "b", ...];
auto generated.
Or is it better not to concern about this kind of optimization because the compiler does this anyway?