MCPcopy Index your code
hub / github.com/brain0/atomic_enum

github.com/brain0/atomic_enum @v0.3.0

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

cargo version docs.rs version

atomic_enum

An attribute to create an atomic wrapper around a C-style enum.

Internally, the generated wrapper uses an AtomicUsize to store the value. The atomic operations have the same semantics as the equivalent operations of AtomicUsize.

Example

# use atomic_enum::atomic_enum;
# use std::sync::atomic::Ordering;
#[atomic_enum]
#[derive(PartialEq)]
enum CatState {
    Dead = 0,
    BothDeadAndAlive,
    Alive,
}

let state = AtomicCatState::new(CatState::Dead);
state.store(CatState::Alive, Ordering::Relaxed);
assert_eq!(state.load(Ordering::Relaxed), CatState::Alive);

This attribute does not use or generate any unsafe code.

The crate can be used in a #[no_std] environment.

Maintenance Note

This crate is passively maintained.

Core symbols most depended-on inside this repo

enum_definition
called by 1
src/lib.rs
atomic_enum_definition
called by 1
src/lib.rs
enum_to_usize
called by 1
src/lib.rs
enum_from_usize
called by 1
src/lib.rs
atomic_enum_new
called by 1
src/lib.rs
atomic_enum_into_inner
called by 1
src/lib.rs
atomic_enum_set
called by 1
src/lib.rs
atomic_enum_get
called by 1
src/lib.rs

Shape

Function 22
Enum 2
Method 1

Languages

Rust100%

Modules by API surface

src/lib.rs18 symbols
tests/nostd.rs4 symbols
tests/with_display.rs3 symbols

For agents

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

⬇ download graph artifact