@@ -19,10 +19,10 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
19
19
/// A mutual exclusion primitive useful for protecting shared data
20
20
///
21
21
/// This mutex will block threads waiting for the lock to become available. The
22
- /// mutex can also be statically initialized or created via a `new`
22
+ /// mutex can also be statically initialized or created via a [ `new`]
23
23
/// constructor. Each mutex has a type parameter which represents the data that
24
24
/// it is protecting. The data can only be accessed through the RAII guards
25
- /// returned from `lock` and `try_lock`, which guarantees that the data is only
25
+ /// returned from [ `lock`] and [ `try_lock`] , which guarantees that the data is only
26
26
/// ever accessed when the mutex is locked.
27
27
///
28
28
/// # Poisoning
@@ -33,16 +33,24 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
33
33
/// data by default as it is likely tainted (some invariant is not being
34
34
/// upheld).
35
35
///
36
- /// For a mutex, this means that the `lock` and `try_lock` methods return a
37
- /// `Result` which indicates whether a mutex has been poisoned or not. Most
38
- /// usage of a mutex will simply `unwrap()` these results, propagating panics
36
+ /// For a mutex, this means that the [ `lock`] and [ `try_lock`] methods return a
37
+ /// [ `Result`] which indicates whether a mutex has been poisoned or not. Most
38
+ /// usage of a mutex will simply [ `unwrap()`] these results, propagating panics
39
39
/// among threads to ensure that a possibly invalid invariant is not witnessed.
40
40
///
41
41
/// A poisoned mutex, however, does not prevent all access to the underlying
42
- /// data. The `PoisonError` type has an `into_inner` method which will return
42
+ /// data. The [ `PoisonError`] type has an [ `into_inner`] method which will return
43
43
/// the guard that would have otherwise been returned on a successful lock. This
44
44
/// allows access to the data, despite the lock being poisoned.
45
45
///
46
+ /// [`new`]: #method.new
47
+ /// [`lock`]: #method.lock
48
+ /// [`try_lock`]: #method.try_lock
49
+ /// [`Result`]: ../../std/result/enum.Result.html
50
+ /// [`unwrap()`]: ../../std/result/enum.Result.html#method.unwrap
51
+ /// [`PoisonError`]: ../../std/sync/struct.PoisonError.html
52
+ /// [`into_inner`]: ../../std/sync/struct.PoisonError.html#method.into_inner
53
+ ///
46
54
/// # Examples
47
55
///
48
56
/// ```
@@ -226,7 +234,7 @@ impl<T: ?Sized> Mutex<T> {
226
234
227
235
/// Attempts to acquire this lock.
228
236
///
229
- /// If the lock could not be acquired at this time, then `Err` is returned.
237
+ /// If the lock could not be acquired at this time, then [ `Err`] is returned.
230
238
/// Otherwise, an RAII guard is returned. The lock will be unlocked when the
231
239
/// guard is dropped.
232
240
///
@@ -238,6 +246,8 @@ impl<T: ?Sized> Mutex<T> {
238
246
/// this call will return failure if the mutex would otherwise be
239
247
/// acquired.
240
248
///
249
+ /// [`Err`]: ../../std/result/enum.Result.html#variant.Err
250
+ ///
241
251
/// # Examples
242
252
///
243
253
/// ```
0 commit comments