Static variable

Static variables, also called global variables, are items that contain a value that is always accessible; it is never created or destroyed. Static variables can have a destructor, but that destructor is never run.

Unlike constants, static variables have a fixed memory location. Their initial value is const-evaluated at compile time and has a  lifetime.

A static variable can be declared within a function, which makes it inaccessible outside of the function; however, this doesn't affect its lifetime (it isn't dropped at the end of the function).

Limitations
Static variables must be thread safe. This means that their type must implement the trait.

Static variables can refer to other static variables, but only through a reference, not by value.

Constants can't refer to a static variable.

Using statics or constants
It can be confusing whether or not you should use a constant item or a static item. Constants should, in general, be preferred over statics unless one of the following are true:


 * Large amounts of data are being stored
 * The single-address property of statics is required.
 * Interior mutability is required.