atomic_state/
lib.rs

1#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))]
2pub mod prelude;
3
4pub mod flag;    pub use flag::AtomFlag;
5pub mod state;   pub use state::AtomState;
6
7pub use once_cell::{ self, sync::Lazy };
8
9/// Initializes a static variable by 'once_cell::Lazy'
10#[macro_export]
11macro_rules! lazy {
12    ($e:expr) => {{
13        ::atomic_state::Lazy::new(|| $e)
14    }}
15}
16
17/// Initializes a static 'AtomState' by 'once_cell::Lazy'
18#[macro_export]
19macro_rules! lazy_state {
20    ($e:expr) => {{
21        ::atomic_state::Lazy::new(|| AtomState::new($e))
22    }}
23}
24
25/// Initializes a static 'AtomFlag' by 'once_cell::Lazy'
26#[macro_export]
27macro_rules! lazy_flag {
28    ($e:expr) => {{
29        ::atomic_state::Lazy::new(|| AtomFlag::new($e))
30    }}
31}