This crate provides a macro to create a static value that gets created when needed
and dropped as soon as its not needed anymore.
It requires the lazy_static
macro to be imported.
Example
extern crate lazy_static;
extern crate weak_static;
;
weak_static!
Outputs:
new
drop
new
drop
The new
prints corresponds to the FOO()
calls of _foo1
and _foo4
.
The drop
prints correspond to the last FOO reference being dropped.