Struct MappedRwLockReadGuard

struct MappedRwLockReadGuard<'rwlock, T: ?Sized + 'rwlock> { ... }

RAII structure used to release the shared read 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 RwLockReadGuard.

Implementations

impl<'rwlock, T: ?Sized> MappedRwLockReadGuard<'rwlock, T>

fn map<U, F>(orig: Self, f: F) -> MappedRwLockReadGuard<'rwlock, U>
where
    F: FnOnce(&T) -> &U,
    U: ?Sized

Makes a MappedRwLockReadGuard for a component of the borrowed data, e.g. an enum variant.

The RwLock is already locked for reading, so this cannot fail.

This is an associated function that needs to be used as MappedRwLockReadGuard::map(...). A method would interfere with methods of the same name on the contents of the MappedRwLockReadGuard used through Deref.

Panics

If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned.

fn filter_map<U, F>(orig: Self, f: F) -> Result<MappedRwLockReadGuard<'rwlock, U>, Self>
where
    F: FnOnce(&T) -> Option<&U>,
    U: ?Sized

Makes a MappedRwLockReadGuard 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 reading, so this cannot fail.

This is an associated function that needs to be used as MappedRwLockReadGuard::filter_map(...). A method would interfere with methods of the same name on the contents of the MappedRwLockReadGuard used through Deref.

Panics

If the closure panics, the guard will be dropped (unlocked) and the RwLock will not be poisoned.

impl<'rwlock, T> Freeze for MappedRwLockReadGuard<'rwlock, T>

impl<'rwlock, T> RefUnwindSafe for MappedRwLockReadGuard<'rwlock, T>

impl<'rwlock, T> Unpin for MappedRwLockReadGuard<'rwlock, T>

impl<'rwlock, T> UnsafeUnpin for MappedRwLockReadGuard<'rwlock, T>

impl<'rwlock, T> UnwindSafe for MappedRwLockReadGuard<'rwlock, T>

impl<P, T> Receiver for MappedRwLockReadGuard<'rwlock, T>

impl<T> Any for MappedRwLockReadGuard<'rwlock, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for MappedRwLockReadGuard<'rwlock, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for MappedRwLockReadGuard<'rwlock, T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for MappedRwLockReadGuard<'rwlock, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToString for MappedRwLockReadGuard<'rwlock, T>

fn to_string(self: &Self) -> String

impl<T, U> Into for MappedRwLockReadGuard<'rwlock, T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for MappedRwLockReadGuard<'rwlock, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for MappedRwLockReadGuard<'rwlock, T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: ?Sized + Sync> Sync for MappedRwLockReadGuard<'_, T>

impl<T: ?Sized + fmt::Debug> Debug for MappedRwLockReadGuard<'_, T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: ?Sized + fmt::Display> Display for MappedRwLockReadGuard<'_, T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: ?Sized> Deref for MappedRwLockReadGuard<'_, T>

fn deref(self: &Self) -> &T

impl<T: ?Sized> Drop for MappedRwLockReadGuard<'_, T>

fn drop(self: &mut Self)

impl<T: ?Sized> Send for MappedRwLockReadGuard<'_, T>