Macro atomic_ref::static_atomic_ref [] [src]

macro_rules! static_atomic_ref {
    ($(#[$attr:meta])* static $N:ident : AtomicRef<$T:ty>; $($t:tt)*) => { ... };
    ($(#[$attr:meta])* pub static $N:ident : AtomicRef<$T:ty>; $($t:tt)*) => { ... };
    (@$VIS:ident, $(#[$attr:meta])* static $N:ident : $T:ty; $($t:tt)*) => { ... };
    (@MAKE TY, PUB, $(#[$attr:meta])*, $N:ident) => { ... };
    (@MAKE TY, PRIV, $(#[$attr:meta])*, $N:ident) => { ... };
    () => { ... };
}

A macro to define a statically allocated AtomicRef<'static, T> which is initialized to None.

Examples

use std::sync::atomic::Ordering;

static_atomic_ref! {
    static SOME_REFERENCE: AtomicRef<i32>;
    pub static PUB_REFERENCE: AtomicRef<u64>;
}

fn main() {
    let a: Option<&'static i32> = SOME_REFERENCE.load(Ordering::SeqCst);
    assert_eq!(a, None);
}