@@ -60,10 +60,13 @@ pub struct Guard {
60
60
61
61
/// A type of error which can be returned whenever a lock is acquired.
62
62
///
63
- /// Both Mutexes and RwLocks are poisoned whenever a thread fails while the lock
63
+ /// Both [`Mutex`]es and [`RwLock`]s are poisoned whenever a thread fails while the lock
64
64
/// is held. The precise semantics for when a lock is poisoned is documented on
65
65
/// each lock, but once a lock is poisoned then all future acquisitions will
66
66
/// return this error.
67
+ ///
68
+ /// [`Mutex`]: ../../std/sync/struct.Mutex.html
69
+ /// [`RwLock`]: ../../std/sync/struct.RwLock.html
67
70
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
68
71
pub struct PoisonError < T > {
69
72
guard : T ,
@@ -85,19 +88,26 @@ pub enum TryLockError<T> {
85
88
86
89
/// A type alias for the result of a lock method which can be poisoned.
87
90
///
88
- /// The `Ok` variant of this result indicates that the primitive was not
89
- /// poisoned, and the `Guard` is contained within. The `Err` variant indicates
90
- /// that the primitive was poisoned. Note that the `Err` variant *also* carries
91
- /// the associated guard, and it can be acquired through the `into_inner`
91
+ /// The [ `Ok`] variant of this result indicates that the primitive was not
92
+ /// poisoned, and the `Guard` is contained within. The [ `Err`] variant indicates
93
+ /// that the primitive was poisoned. Note that the [ `Err`] variant *also* carries
94
+ /// the associated guard, and it can be acquired through the [ `into_inner`]
92
95
/// method.
96
+ ///
97
+ /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
98
+ /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
99
+ /// [`into_inner`]: ../../std/sync/struct.Mutex.html#method.into_inner
93
100
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
94
101
pub type LockResult < Guard > = Result < Guard , PoisonError < Guard > > ;
95
102
96
103
/// A type alias for the result of a nonblocking locking method.
97
104
///
98
- /// For more information, see `LockResult`. A `TryLockResult` doesn't
99
- /// necessarily hold the associated guard in the `Err` type as the lock may not
105
+ /// For more information, see [ `LockResult`] . A `TryLockResult` doesn't
106
+ /// necessarily hold the associated guard in the [ `Err`] type as the lock may not
100
107
/// have been acquired for other reasons.
108
+ ///
109
+ /// [`LockResult`]: ../../std/sync/type.LockResult.html
110
+ /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
101
111
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
102
112
pub type TryLockResult < Guard > = Result < Guard , TryLockError < Guard > > ;
103
113
@@ -124,6 +134,11 @@ impl<T> Error for PoisonError<T> {
124
134
125
135
impl < T > PoisonError < T > {
126
136
/// Creates a `PoisonError`.
137
+ ///
138
+ /// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`].
139
+ ///
140
+ /// [`Mutex::lock`]: ../../std/sync/struct.Mutex.html#method.lock
141
+ /// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read
127
142
#[ stable( feature = "sync_poison" , since = "1.2.0" ) ]
128
143
pub fn new ( guard : T ) -> PoisonError < T > {
129
144
PoisonError { guard : guard }
0 commit comments