(s: Self, f: F)
| 34 | |
| 35 | impl<'a, R: RawMutex, T: ?Sized> ImmutableMappedMutexGuard<'a, R, T> { |
| 36 | pub fn map<U: ?Sized, F>(s: Self, f: F) -> ImmutableMappedMutexGuard<'a, R, U> |
| 37 | where |
| 38 | F: FnOnce(&T) -> &U, |
| 39 | { |
| 40 | let raw = s.raw; |
| 41 | let data = f(&s) as *const U; |
| 42 | core::mem::forget(s); |
| 43 | ImmutableMappedMutexGuard { |
| 44 | raw, |
| 45 | data, |
| 46 | _marker: PhantomData, |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | impl<R: RawMutex, T: ?Sized> Deref for ImmutableMappedMutexGuard<'_, R, T> { |