1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*******************************************************************************
*
* Copyright (c) 2025 - 2026 Haixing Hu.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0.
*
******************************************************************************/
//! # qubit-atomic
//!
//! User-friendly atomic operations wrapper providing JDK-like atomic API.
//!
//! This crate provides an easy-to-use generic atomic wrapper with reasonable
//! default memory orderings, similar to Java's
//! `java.util.concurrent.atomic` package.
//!
//! ## Design Goals
//!
//! - **Ease of Use**: Hides memory ordering complexity with reasonable defaults
//! - **Completeness**: Provides high-level operations similar to JDK atomic
//! - **Safety**: Guarantees memory safety and thread safety
//! - **Performance**: Zero-cost abstraction with no additional overhead
//! - **Flexibility**: Exposes underlying types via `inner()` for advanced users
//!
//! ## Features
//!
//! - Primitive atomic values: `Atomic<bool>`, `Atomic<i32>`,
//! `Atomic<u64>`, `Atomic<usize>`, `Atomic<f32>`, and other supported
//! primitive types
//! - Counter atomic types: `AtomicCount`, `AtomicSignedCount`
//! - Reference atomic type: `AtomicRef<T>`
//! - Shared-owner wrappers: `ArcAtomic<T>`, `ArcAtomicRef<T>`,
//! `ArcAtomicCount`, and `ArcAtomicSignedCount`
//!
//! ## Example
//!
//! ```rust
//! use qubit_atomic::Atomic;
//! use std::sync::Arc;
//! use std::thread;
//!
//! // Basic usage
//! let counter = Atomic::new(0);
//! counter.fetch_inc();
//! assert_eq!(counter.load(), 1);
//!
//! // Concurrent usage
//! let counter = Arc::new(Atomic::new(0));
//! let mut handles = vec![];
//!
//! for _ in 0..10 {
//! let counter = counter.clone();
//! let handle = thread::spawn(move || {
//! for _ in 0..100 {
//! counter.fetch_inc();
//! }
//! });
//! handles.push(handle);
//! }
//!
//! for handle in handles {
//! handle.join().unwrap();
//! }
//!
//! assert_eq!(counter.load(), 1000);
//! ```
//!
/// Atomic value types and reference/counting helpers.
// Re-export the public atomic API.
pub use ;