Crates.io | relaxed |
lib.rs | relaxed |
version | 0.1.1 |
source | src |
created_at | 2024-09-09 14:40:33.295381 |
updated_at | 2024-09-13 19:18:23.594801 |
description | Wrappers around Atomics that always use `Ordering::Relaxed` |
homepage | |
repository | https://github.com/dimpolo/relaxed/ |
max_upload_size | |
id | 1369389 |
size | 20,110 |
Wrappers around Atomics that always use Ordering::Relaxed
// instead of:
use std::sync::atomic::{AtomicBool, Ordering};
let atomic = AtomicBool::new(false);
atomic.store(true, Ordering::Relaxed);
assert_eq!(atomic.load(Ordering::Relaxed), true);
// you can do:
use relaxed::RelaxedBool;
let atomic = RelaxedBool::new(false);
atomic.set(true);
assert_eq!(atomic.get(), true);