pub struct MappedRwLockWriteGuard<'rwlock, T>where
T: 'rwlock + ?Sized,{ /* private fields */ }mapped_lock_guards)Expand description
RAII structure used to release the exclusive write access of a lock when dropped, which can point to a subfield of the protected data.
This structure is created by the map and filter_map methods
on RwLockWriteGuard.
Implementations§
Source§impl<'rwlock, T> MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,
Sourcepub fn map<U, F>(
orig: MappedRwLockWriteGuard<'rwlock, T>,
f: F,
) -> MappedRwLockWriteGuard<'rwlock, U>
🔬This is a nightly-only experimental API. (mapped_lock_guards)
pub fn map<U, F>( orig: MappedRwLockWriteGuard<'rwlock, T>, f: F, ) -> MappedRwLockWriteGuard<'rwlock, U>
mapped_lock_guards)Makes a MappedRwLockWriteGuard for a component of the borrowed data,
e.g. an enum variant.
The RwLock is already locked for writing, so this cannot fail.
This is an associated function that needs to be used as
MappedRwLockWriteGuard::map(...). A method would interfere with
methods of the same name on the contents of the MappedRwLockWriteGuard
used through Deref.
§Panics
If the closure panics, the guard will be dropped (unlocked).
Sourcepub fn filter_map<U, F>(
orig: MappedRwLockWriteGuard<'rwlock, T>,
f: F,
) -> Result<MappedRwLockWriteGuard<'rwlock, U>, MappedRwLockWriteGuard<'rwlock, T>>
🔬This is a nightly-only experimental API. (mapped_lock_guards)
pub fn filter_map<U, F>( orig: MappedRwLockWriteGuard<'rwlock, T>, f: F, ) -> Result<MappedRwLockWriteGuard<'rwlock, U>, MappedRwLockWriteGuard<'rwlock, T>>
mapped_lock_guards)Makes a MappedRwLockWriteGuard for a component of the borrowed data.
The original guard is returned as an Err(...) if the closure returns
None.
The RwLock is already locked for writing, so this cannot fail.
This is an associated function that needs to be used as
MappedRwLockWriteGuard::filter_map(...). A method would interfere with
methods of the same name on the contents of the MappedRwLockWriteGuard
used through Deref.
§Panics
If the closure panics, the guard will be dropped (unlocked).
Trait Implementations§
Source§impl<T> Debug for MappedRwLockWriteGuard<'_, T>
impl<T> Debug for MappedRwLockWriteGuard<'_, T>
Source§impl<T> Deref for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
impl<T> Deref for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
Source§impl<T> DerefMut for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
impl<T> DerefMut for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
Source§impl<T> Display for MappedRwLockWriteGuard<'_, T>
impl<T> Display for MappedRwLockWriteGuard<'_, T>
Source§impl<T> Drop for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
impl<T> Drop for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
impl<T> !Send for MappedRwLockWriteGuard<'_, T>where
T: ?Sized,
impl<T> Sync for MappedRwLockWriteGuard<'_, T>
Auto Trait Implementations§
impl<'rwlock, T> Freeze for MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> RefUnwindSafe for MappedRwLockWriteGuard<'rwlock, T>where
T: RefUnwindSafe + ?Sized,
impl<'rwlock, T> Unpin for MappedRwLockWriteGuard<'rwlock, T>where
T: ?Sized,
impl<'rwlock, T> !UnwindSafe for MappedRwLockWriteGuard<'rwlock, T>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
Access::load.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Source for T
impl<T> Source for T
Source§type Slice<'a> = <<T as Deref>::Target as Source>::Slice<'a>
where
T: 'a
type Slice<'a> = <<T as Deref>::Target as Source>::Slice<'a> where T: 'a
Source can be sliced into.Source§fn read<'a, Chunk>(&'a self, offset: usize) -> Option<Chunk>where
Chunk: Chunk<'a>,
fn read<'a, Chunk>(&'a self, offset: usize) -> Option<Chunk>where
Chunk: Chunk<'a>,
None when reading
out of bounds would occur. Read moreSource§unsafe fn read_byte_unchecked(&self, offset: usize) -> u8
unsafe fn read_byte_unchecked(&self, offset: usize) -> u8
Source§fn slice(&self, range: Range<usize>) -> Option<<T as Source>::Slice<'_>>
fn slice(&self, range: Range<usize>) -> Option<<T as Source>::Slice<'_>>
slice::get(range). Read moreSource§unsafe fn slice_unchecked(
&self,
range: Range<usize>,
) -> <T as Source>::Slice<'_>
unsafe fn slice_unchecked( &self, range: Range<usize>, ) -> <T as Source>::Slice<'_>
slice::get_unchecked(range). Read more