Skip to main content

qubit_lock/lock/
mod.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026.
4 *    Haixing Hu, Qubit Co. Ltd.
5 *
6 *    All rights reserved.
7 *
8 ******************************************************************************/
9//! # Lock Module
10//!
11//! Provides synchronous and asynchronous lock abstractions along
12//! with their implementations. This module offers unified interfaces
13//! for different types of locks through traits, making it easier to
14//! write generic code that works with multiple lock types.
15//!
16//! # Author
17//!
18//! Haixing Hu
19
20// 子模块 `lock` 存放同步锁 trait `Lock`,与父模块同名是刻意分层;避免 clippy::module_inception 误报
21#![allow(clippy::module_inception)]
22
23// Trait definitions
24mod async_lock;
25mod lock;
26mod try_lock_error;
27
28// Implementations
29mod arc_async_mutex;
30mod arc_async_rw_lock;
31mod arc_mutex;
32mod arc_rw_lock;
33mod arc_std_mutex;
34
35// Re-export traits
36// Re-export implementations
37pub use crate::monitor::{
38    ArcMonitor,
39    Monitor,
40    MonitorGuard,
41    WaitTimeoutResult,
42    WaitTimeoutStatus,
43};
44pub use arc_async_mutex::ArcAsyncMutex;
45pub use arc_async_rw_lock::ArcAsyncRwLock;
46pub use arc_mutex::ArcMutex;
47pub use arc_rw_lock::ArcRwLock;
48pub use arc_std_mutex::ArcStdMutex;
49pub use async_lock::AsyncLock;
50pub use lock::Lock;
51pub use try_lock_error::TryLockError;