#atomically #atomic #options #read #value #destroy #destroyed

no-std atomic-destroy

An value which can be atomically read and destroyed; like an atomic Option

1 unstable release

0.1.0 Jun 11, 2020

#969 in Concurrency

MIT/Apache

10KB
176 lines

Atomic Destroy

This crate provides a type which can hold a value and can be atomically destroyed; like an atomic Option.

It does not require the standard library.

Examples

use atomic_destroy::AtomicDestroy;

let value = AtomicDestroy::new(Box::new(5));
assert_eq!(**value.get().unwrap(), 5);
value.destroy();
// The Box's destructor is run here.
assert!(value.get().is_none());

lib.rs:

Atomically destroyable types.

Examples

let value = AtomicDestroy::new(Box::new(5));
assert_eq!(**value.get().unwrap(), 5);
value.destroy();
// The Box's destructor is run here.
assert!(value.get().is_none());

No runtime deps