4 releases
0.2.1 | Jan 2, 2025 |
---|---|
0.2.0 | Dec 30, 2024 |
0.1.1 | Dec 28, 2024 |
0.1.0 | Dec 28, 2024 |
#302 in Concurrency
465 downloads per month
30KB
545 lines
atomiq
Convenient tool for atomics in Rust.
Inspired by the atomig
crate, but with a more flexible design.
Features
- Common atomic struct
Atomic<T>
. - Traits like
Atomizable
with a derive macro for easy implementation. - Standard library/core implementation.
- Loom implementation for testing (
loom
crate feature). - Atomic option type.
lib.rs
:
Convenient tool for atomics in Rust.
Crate features
alloc
--- enables the Arc
type. (default)
derive
--- enables the derive macros. (default)
loom
--- replaces the default implementation with the loom
mock.
Usage
use atomiq::prelude::*;
let atomic: Atomic<bool> = Atomic::from(false);
atomic.store(true, Ordering::Release);
assert_eq!(atomic.load(Ordering::Acquire), true);
Dependencies
~0–23MB
~303K SLoC