| Crates.io | atomex |
| lib.rs | atomex |
| version | 0.1.1 |
| created_at | 2024-10-09 09:23:20.82389+00 |
| updated_at | 2025-06-14 14:14:32.405622+00 |
| description | Atomics extensions in Rust |
| homepage | |
| repository | https://github.com/ljsnogard/atomex-rs |
| max_upload_size | |
| id | 1402187 |
| size | 46,684 |
Some useful extensions around Atomic* in core::sync::atomic.
This crate is mainly inspired by atomic-traits
use core::sync::atomic::*;
use atomex::AtomicCount;
let atm = AtomicUsize::new(0usize);
let cnt = AtomicCount::<usize, AtomicUsize>::new(atm);
let mut atm = cnt.into_inner();
let cnt = AtomicCount::<usize, &mut AtomicUsize>::new(&mut atm);
assert_eq!(cnt.inc(), 0usize);
assert_eq!(cnt.dec(), 1usize);
assert_eq!(cnt.val(), 0usize);