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 traits and concrete parking_lot,
19//! standard-library, Tokio, and mock monitor implementations.
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 ArcMockMonitor,
51 ArcParkingLotMonitor,
52 ArcStdMonitor,
53 ConditionWaiter,
54 MockMonitor,
55 Monitor,
56 NotificationWaiter,
57 Notifier,
58 ParkingLotMonitor,
59 ParkingLotMonitorGuard,
60 SharedMonitor,
61 StdMonitor,
62 StdMonitorGuard,
63 TimeoutConditionWaiter,
64 TimeoutNotificationWaiter,
65 WaitTimeoutResult,
66 WaitTimeoutStatus,
67};
68#[cfg(feature = "async")]
69pub use monitor::{
70 ArcTokioMonitor,
71 AsyncConditionWaiter,
72 AsyncMonitor,
73 AsyncMonitorFuture,
74 AsyncNotificationWaiter,
75 AsyncTimeoutConditionWaiter,
76 AsyncTimeoutNotificationWaiter,
77 SharedAsyncMonitor,
78 TokioMonitor,
79};