docs.rs failed to build lazy_static-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
lazy_static-1.5.0
lazy-static.rs
A macro for declaring lazily evaluated statics in Rust.
Using this macro, it is possible to have static
s 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.
Syntax
lazy_static!
Semantic
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 NAME
.
On first deref, EXPR
gets evaluated and stored internally, such that all further derefs
can return a reference to the same object.
Like regular static mut
s, this macro only works for types that fulfill the Share
trait.
Example
Using the macro:
extern crate lazy_static;
use HashMap;
lazy_static!