diff options
Diffstat (limited to 'embassy-sync')
| -rw-r--r-- | embassy-sync/src/mutex.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/embassy-sync/src/mutex.rs b/embassy-sync/src/mutex.rs index 75a6e8dd3..92101c6b5 100644 --- a/embassy-sync/src/mutex.rs +++ b/embassy-sync/src/mutex.rs | |||
| @@ -111,6 +111,22 @@ where | |||
| 111 | 111 | ||
| 112 | Ok(MutexGuard { mutex: self }) | 112 | Ok(MutexGuard { mutex: self }) |
| 113 | } | 113 | } |
| 114 | |||
| 115 | /// Consumes this mutex, returning the underlying data. | ||
| 116 | pub fn into_inner(self) -> T | ||
| 117 | where | ||
| 118 | T: Sized, | ||
| 119 | { | ||
| 120 | self.inner.into_inner() | ||
| 121 | } | ||
| 122 | |||
| 123 | /// Returns a mutable reference to the underlying data. | ||
| 124 | /// | ||
| 125 | /// Since this call borrows the Mutex mutably, no actual locking needs to | ||
| 126 | /// take place -- the mutable borrow statically guarantees no locks exist. | ||
| 127 | pub fn get_mut(&mut self) -> &mut T { | ||
| 128 | self.inner.get_mut() | ||
| 129 | } | ||
| 114 | } | 130 | } |
| 115 | 131 | ||
| 116 | /// Async mutex guard. | 132 | /// Async mutex guard. |
