Skip to main content

qubit_cas/
lib.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Typed compare-and-swap executor for synchronous and asynchronous workflows.
11//!
12//! `CasExecutor<T, E>` binds the shared state type `T` and operation error type
13//! `E`. Each execution call introduces its own business output type `R`, so one
14//! executor configuration can serve multiple CAS operations over the same state.
15
16#![deny(missing_docs)]
17#![deny(unsafe_op_in_unsafe_fn)]
18
19mod cas_decision;
20mod cas_outcome;
21mod cas_success;
22pub mod constants;
23pub mod error;
24pub mod event;
25pub mod executor;
26pub mod fast;
27pub mod observability;
28pub mod options;
29pub mod report;
30pub mod strategy;
31
32pub use cas_decision::CasDecision;
33pub use cas_outcome::CasOutcome;
34pub use cas_success::CasSuccess;
35pub use error::{
36    CasAttemptFailure,
37    CasAttemptFailureKind,
38    CasError,
39    CasErrorKind,
40};
41pub use event::{
42    CasContext,
43    CasEvent,
44    CasHooks,
45};
46pub use executor::{
47    CasBuilder,
48    CasExecutor,
49};
50pub use fast::{
51    FastCas,
52    FastCasDecision,
53    FastCasError,
54    FastCasPolicy,
55    FastCasState,
56    FastCasSuccess,
57};
58pub use observability::{
59    CasAlert,
60    CasObservabilityConfig,
61    CasObservabilityMode,
62    ContentionThresholds,
63    ListenerPanicPolicy,
64};
65pub use options::CasTimeoutPolicy;
66pub use report::{
67    CasExecutionOutcome,
68    CasExecutionReport,
69};
70pub use strategy::{
71    CasStrategy,
72    CasStrategyProfile,
73};