@@ -24,7 +24,7 @@ const BLOCKED: usize = 1 << 1;
24
24
/// # Examples
25
25
///
26
26
/// ```
27
- /// # fn main() { async_std::task::block_on(async {
27
+ /// # async_std::task::block_on(async {
28
28
/// #
29
29
/// use std::sync::Arc;
30
30
///
@@ -46,7 +46,7 @@ const BLOCKED: usize = 1 << 1;
46
46
/// }
47
47
/// assert_eq!(*m.lock().await, 10);
48
48
/// #
49
- /// # }) }
49
+ /// # })
50
50
/// ```
51
51
pub struct Mutex < T > {
52
52
state : AtomicUsize ,
@@ -82,7 +82,7 @@ impl<T> Mutex<T> {
82
82
/// # Examples
83
83
///
84
84
/// ```
85
- /// # fn main() { async_std::task::block_on(async {
85
+ /// # async_std::task::block_on(async {
86
86
/// #
87
87
/// use std::sync::Arc;
88
88
///
@@ -99,7 +99,7 @@ impl<T> Mutex<T> {
99
99
///
100
100
/// assert_eq!(*m2.lock().await, 20);
101
101
/// #
102
- /// # }) }
102
+ /// # })
103
103
/// ```
104
104
pub async fn lock ( & self ) -> MutexGuard < ' _ , T > {
105
105
pub struct LockFuture < ' a , T > {
@@ -196,7 +196,7 @@ impl<T> Mutex<T> {
196
196
/// # Examples
197
197
///
198
198
/// ```
199
- /// # fn main() { async_std::task::block_on(async {
199
+ /// # async_std::task::block_on(async {
200
200
/// #
201
201
/// use std::sync::Arc;
202
202
///
@@ -217,7 +217,7 @@ impl<T> Mutex<T> {
217
217
///
218
218
/// assert_eq!(*m2.lock().await, 20);
219
219
/// #
220
- /// # }) }
220
+ /// # })
221
221
/// ```
222
222
pub fn try_lock ( & self ) -> Option < MutexGuard < ' _ , T > > {
223
223
if self . state . fetch_or ( LOCK , Ordering :: Acquire ) & LOCK == 0 {
@@ -249,15 +249,15 @@ impl<T> Mutex<T> {
249
249
/// # Examples
250
250
///
251
251
/// ```
252
- /// # fn main() { async_std::task::block_on(async {
252
+ /// # async_std::task::block_on(async {
253
253
/// #
254
254
/// use async_std::sync::Mutex;
255
255
///
256
256
/// let mut mutex = Mutex::new(0);
257
257
/// *mutex.get_mut() = 10;
258
258
/// assert_eq!(*mutex.lock().await, 10);
259
259
/// #
260
- /// # }) }
260
+ /// # })
261
261
/// ```
262
262
pub fn get_mut ( & mut self ) -> & mut T {
263
263
unsafe { & mut * self . value . get ( ) }
0 commit comments