A macro for declaring lazily evaluated statics in Rust.
Using this macro, it is possible to have
statics that require code to be
executed at runtime in order to be initialized.
This includes anything requiring heap allocations, like vectors or hash maps,
as well as anything that requires function calls to be computed.
For a given
static ref NAME: TYPE = EXPR;, the macro generates a
unique type that implements
Deref<TYPE> and stores it in a static with name
On first deref,
EXPR gets evaluated and stored internally, such that all further derefs
can return a reference to the same object.
static muts, this macro only works for types that fulfill the
lazy-static.rs is available on crates.io. Add the following dependency to your Cargo manifest to get the latest version of the 0.1 branch:
 = "0.1.*"
To always get the latest version, add this git repository to your Cargo manifest:
 = "https://github.com/rust-lang-nursery/lazy-static.rs"
Using the macro:
extern crate lazy_static; use HashMap; lazy_static!