[][src]Type Definition arc_swap::ArcSwapOption

type ArcSwapOption<T> = ArcSwapAny<Option<Arc<T>>>;

An atomic storage for Option<Arc>.

This is very similar to ArcSwap, but allows storing NULL values, which is useful in some situations.

This is a type alias only. Most of the methods are described on ArcSwapAny. Even though the examples there often use ArcSwap, they are applicable to ArcSwapOption with appropriate changes.


use std::sync::Arc;
use arc_swap::ArcSwapOption;

let shared = ArcSwapOption::from(None);
assert_eq!(42, **shared.load_full().as_ref().unwrap());