Skip to main content

qubit_fast_cas/
lib.rs

1// =============================================================================
2//    Copyright (c) 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Lightweight compare-and-swap primitives for `u64` state words.
9//!
10//! [`CasCell`] owns an atomic state word and retries functional updates until
11//! they commit or return a business error. [`FastCas`] adds bounded conflict
12//! policies and attempt metadata for callers that need explicit control.
13//!
14//! Update closures may execute repeatedly after conflicts and should avoid
15//! non-idempotent side effects.
16
17#![deny(missing_docs)]
18#![deny(unsafe_op_in_unsafe_fn)]
19
20mod cas_cell;
21mod fast_cas;
22mod fast_cas_decision;
23mod fast_cas_error;
24mod fast_cas_policy;
25mod fast_cas_state;
26mod fast_cas_success;
27
28pub use cas_cell::CasCell;
29pub use fast_cas::FastCas;
30pub use fast_cas_decision::FastCasDecision;
31pub use fast_cas_error::FastCasError;
32pub use fast_cas_policy::FastCasPolicy;
33pub use fast_cas_state::FastCasState;
34pub use fast_cas_success::FastCasSuccess;