One challenge you run into when creating constants is that it can be difficult to correctly initialize it to the value you want, because Rust does not allow initialization code that runs before main which you may be used to in C++. It has to be able to figure out the value at compile time.
Basically in order to call a function when initializing a constant, it must be const. This means that the compiler knows how to run it at compile time, so it can hard code the result in the exe file. The
const_fn feature is a compiler feature that allows declaring a few more functions as const than currently possible in stable Rust.
Lazy static is a crate that provides a macro that allows you to make a constant which is initialized the first time you use it, which sidesteps the difficulties with initialization.