MCPcopy Index your code
hub / github.com/Amanieu/atomic-rs

github.com/Amanieu/atomic-rs @v0.6.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.1 ↗ · + Follow
73 symbols 182 edges 4 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Generic Atomic<T> for Rust

Build Status Crates.io

A Rust library which provides a generic Atomic<T> type for all T: NoUninit types, unlike the standard library which only provides a few fixed atomic types (AtomicBool, AtomicIsize, AtomicUsize, AtomicPtr). The NoUninit bound is from the bytemuck crate, and indicates that a type has no internal padding bytes. You will need to derive or implement this trait for all types used with Atomic<T>.

This library will use native atomic instructions if possible, and will otherwise fall back to a lock-based mechanism. You can use the Atomic::<T>::is_lock_free() function to check whether native atomic operations are supported for a given type. Note that a type must have a power-of-2 size and alignment in order to be used by native atomic instructions.

This crate uses #![no_std] and only depends on libcore.

Documentation

Features

This crate has the following Cargo features:

  • fallback: Fall back to locks when atomic instructions cannot be used. (Enabled by default.)
  • serde: Enables serialization and serialization of Atomic<T> with serde.

Usage

Add this to your Cargo.toml:

[dependencies]
atomic = "0.6"

and this to your crate root:

extern crate atomic;

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Core symbols most depended-on inside this repo

store
called by 17
src/lib.rs
assert_serde
called by 16
src/lib.rs
lock
called by 11
src/fallback.rs
inner_ptr
called by 9
src/lib.rs
load
called by 4
src/lib.rs
compare_exchange_weak
called by 2
src/lib.rs
atomic_load
called by 1
src/ops.rs
atomic_store
called by 1
src/ops.rs

Shape

Function 46
Method 21
Class 6

Languages

Rust100%

Modules by API surface

src/lib.rs37 symbols
src/fallback.rs18 symbols
src/ops.rs16 symbols
src/serde_impl.rs2 symbols

For agents

$ claude mcp add atomic-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page