I want to create a list of static compile time generated variables. That is, when the program starts, they are already there and I don't need to mutate it.
Currently I'm doing like this:
pub type ProfilerInfo = (&'static str, &'static str);
pub const Fps: ProfilerInfo = ("fps", "Frames Per Second");
pub const DecodingElapsed: ProfilerInfo = ("det", "Decoding Elapsed Time");
pub const DecodedPerSec: ProfilerInfo = ("dps", "Decoded Per Second");
pub const BytesPerSec: ProfilerInfo = ("bps", "Bytes Per Second");
pub const ALL_VARIABLES: &'static [&'static ProfilerInfo] = &[&Fps, &DecodingElapsed, &DecodedPerSec, &BytesPerSec];
however this is error prone, I could forget to add one of the variables on the list ALL_VARIABLES.
Is there a way to create a macro that creates a ProfilerInfo and adds to ALL_VARIABLES?
Context: why I need this? Well, this list is to be returned by the command line like this my_program --list-variables, so it's nice for it to be done when the app starts.
I don't think it's possible with an array like I did on the top but maybe with a Vec?