MCPcopy Index your code
hub / github.com/RustPython/RustPython / map

Method map

crates/common/src/lock/immutable_mutex.rs:36–48  ·  view source on GitHub ↗
(s: Self, f: F)

Source from the content-addressed store, hash-verified

34
35impl<'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
51impl<R: RawMutex, T: ?Sized> Deref for ImmutableMappedMutexGuard<'_, R, T> {

Callers

nothing calls this directly

Calls 2

forgetFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected