pub struct MappedBufferGuard<M: RawMutex + 'static, U: ?Sized> { /* private fields */ }Expand description
Like BufferGuard, but derefs to a borrowed U (often a slice or inner field).
Dropping this guard marks the same pool index free as the original BufferGuard.
Implementations§
Source§impl<M: RawMutex + 'static, U: ?Sized> MappedBufferGuard<M, U>
impl<M: RawMutex + 'static, U: ?Sized> MappedBufferGuard<M, U>
Sourcepub fn map<V: ?Sized>(
orig: Self,
fun: impl FnOnce(&mut U) -> &mut V,
) -> MappedBufferGuard<M, V>
pub fn map<V: ?Sized>( orig: Self, fun: impl FnOnce(&mut U) -> &mut V, ) -> MappedBufferGuard<M, V>
Chains BufferGuard::map: re-borrows &mut U into &mut V without releasing the
pool slot until the final mapped guard is dropped.
Same as BufferGuard::map: orig: Self instead of self, so call
MappedBufferGuard::map(guard, f) and keep guard.map(...) available for U::map
via Deref / DerefMut.
Trait Implementations§
Auto Trait Implementations§
impl<M, U> Freeze for MappedBufferGuard<M, U>where
U: ?Sized,
impl<M, U> !RefUnwindSafe for MappedBufferGuard<M, U>
impl<M, U> !Send for MappedBufferGuard<M, U>
impl<M, U> !Sync for MappedBufferGuard<M, U>
impl<M, U> Unpin for MappedBufferGuard<M, U>where
U: ?Sized,
impl<M, U> UnsafeUnpin for MappedBufferGuard<M, U>where
U: ?Sized,
impl<M, U> !UnwindSafe for MappedBufferGuard<M, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more