atomic-destroy

Crates.ioatomic-destroy
lib.rsatomic-destroy
version0.1.0
sourcesrc
created_at2020-06-11 15:38:11.948143
updated_at2020-06-11 15:38:11.948143
descriptionAn value which can be atomically read and destroyed; like an atomic Option.
homepage
repositoryhttps://github.com/Koxiaet/atomic-destroy
max_upload_size
id252830
size9,892
(Kestrer)

documentation

README

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());
Commit count: 6

cargo fmt