Expand description
This crate provides the take_static
macro to create statics that provide mutable access only once:
use take_static::take_static;
take_static! {
static NUMBER: usize = 5;
}
assert_eq!(NUMBER.take(), Some(&mut 5));
assert_eq!(NUMBER.take(), None);
The resulting statics are TakeStatic
.
Macros§
- take_
static - Declare a new static that provides mutable access—but only once.
Structs§
- Take
Static - A synchronization primitive which can be accessed only once.