#atomic #lock-free #threading #no-std

no-std atomiq

Convenient tool for atomics in Rust

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

Download history 307/week @ 2024-12-25 158/week @ 2025-01-01

465 downloads per month

MPL-2.0 license

30KB
545 lines

Maintenance Crates.io version Docs.rs Size License

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