qubit_lock/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//! # Qubit Lock
11//!
12//! Lock utilities for the Qubit Rust libraries.
13//!
14//! The crate provides:
15//!
16//! - Synchronous lock wrappers with `Arc` integrated internally.
17//! - Optional asynchronous Tokio-based lock wrappers behind the `async` feature.
18//! - Monitor-style coordination built on `parking_lot` and standard-library
19//! `Mutex` plus `Condvar` pairs.
20//!
21//! Public API items are re-exported from the crate root. The internal
22//! `lock` and `monitor` modules are implementation details and are not public
23//! import paths.
24//!
25//! ```compile_fail
26//! use qubit_lock::lock::Lock;
27//! ```
28//!
29//! ```compile_fail
30//! use qubit_lock::monitor::Monitor;
31//! ```
32
33mod lock;
34mod monitor;
35#[cfg(feature = "async")]
36pub use lock::{
37 ArcAsyncMutex,
38 ArcAsyncRwLock,
39 AsyncLock,
40};
41pub use lock::{
42 ArcMutex,
43 ArcRwLock,
44 ArcStdMutex,
45 ArcStdRwLock,
46 Lock,
47 TryLockError,
48};
49pub use monitor::{
50 ArcMonitor,
51 ArcStdMonitor,
52 Monitor,
53 MonitorGuard,
54 StdMonitor,
55 StdMonitorGuard,
56 WaitTimeoutResult,
57 WaitTimeoutStatus,
58};