1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! `proxima::sync::Mutex` — async mutex, shape-compatible with
//! `tokio::sync::Mutex`. Backed by `futures::lock::Mutex` (no runtime
//! coupling). Thin newtype: forwards `lock` / `get_mut` / `into_inner`
//! to the futures variant; reshapes `try_lock` so the return is
//! `Result<MutexGuard<'_, T>, TryLockError>` matching tokio's shape
//! rather than the futures crate's `Option<MutexGuard<'_, T>>`.
//!
//! Cancel-safety nuance: tokio's `lock()` future is documented
//! cancel-safe — dropping the future before it resolves leaves the
//! mutex untouched. `futures::lock::Mutex::lock()` has the same
//! property (the future never holds the lock until it resolves), so
//! the semantics carry over.
//!
//! # Non-coverage
//!
//! The following tokio APIs are NOT shimmed:
//!
//! - `lock_owned() -> OwnedMutexGuard<T>` — tokio's owned-guard
//! variant requires `Arc<Mutex<T>>` self and returns a guard whose
//! lifetime is decoupled from any reference. `futures::lock::Mutex`
//! has no analog. Migration: clone the `Arc<Mutex<T>>`, hold it
//! alongside the guard, drop guard first.
//! - `try_lock_owned() -> Result<OwnedMutexGuard<T>, TryLockError>` —
//! same as above; no owned variant.
//! - `Mutex::blocking_lock()` — sync-context lock acquisition. Don't
//! call sync APIs from async code; if you need this, the design is
//! probably wrong. Use `std::sync::Mutex` for non-async paths.
use fmt;
pub use ;
/// Async mutex matching `tokio::sync::Mutex`'s API shape, backed by
/// `futures::lock::Mutex`.
;
/// Error returned by `Mutex::try_lock` when the lock would block.
/// Matches `tokio::sync::TryLockError`'s shape (unit-payload).
);
/// Crate-internal constructor — other primitives (`RwLock`) that
/// also reshape `Option` → `Result<_, TryLockError>` need to build
/// the error without exposing the private inner.
pub