Skip to main content

Guard

Trait Guard 

Source
pub trait Guard<'a, T>: Deref<Target = T>
where T: ?Sized,
{ type Mapped<U: 'a + ?Sized>; // Required method fn guard_map<U, F>(self, f: F) -> Self::Mapped<U> where F: FnOnce(&T) -> &U, U: 'a + ?Sized; }

Required Associated Types§

Source

type Mapped<U: 'a + ?Sized>

Required Methods§

Source

fn guard_map<U, F>(self, f: F) -> Self::Mapped<U>
where F: FnOnce(&T) -> &U, U: 'a + ?Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T> Guard<'a, T> for &'a T

Source§

type Mapped<U: 'a + ?Sized> = &'a U

Source§

fn guard_map<U, F>(self, f: F) -> <&'a T as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&'a T) -> &'a U, U: 'a + ?Sized,

Source§

impl<'a, T> Guard<'a, T> for &'a mut T

Source§

type Mapped<U: 'a + ?Sized> = &'a U

Source§

fn guard_map<U, F>(self, f: F) -> <&'a mut T as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&'a T) -> &'a U, U: 'a + ?Sized,

Source§

impl<'a, T> Guard<'a, T> for Ref<'a, T>
where T: ?Sized,

Available on crate feature std only.
Source§

type Mapped<U: 'a + ?Sized> = Ref<'a, U>

Source§

fn guard_map<U, F>(self, f: F) -> <Ref<'a, T> as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&T) -> &U, U: 'a + ?Sized,

Source§

impl<'a, T> Guard<'a, T> for MappedRwLockReadGuard<'a, T>

Available on crate feature std only.
Source§

type Mapped<U: 'a + ?Sized> = MappedRwLockReadGuard<'a, U>

Source§

fn guard_map<U, F>( self, f: F, ) -> <MappedRwLockReadGuard<'a, T> as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&T) -> &U, U: 'a + ?Sized,

Source§

impl<'a, T> Guard<'a, T> for RwLockReadGuard<'a, T>
where T: ?Sized,

Available on crate feature std only.
Source§

type Mapped<U: 'a + ?Sized> = MappedRwLockReadGuard<'a, U>

Source§

fn guard_map<U, F>( self, f: F, ) -> <RwLockReadGuard<'a, T> as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&T) -> &U, U: 'a + ?Sized,

Source§

impl<'a, T> Guard<'a, T> for RwLockWriteGuard<'a, T>
where T: ?Sized,

Available on crate feature std only.
Source§

type Mapped<U: 'a + ?Sized> = MappedRwLockReadGuard<'a, U>

Source§

fn guard_map<U, F>( self, f: F, ) -> <RwLockWriteGuard<'a, T> as Guard<'a, T>>::Mapped<U>
where F: FnOnce(&T) -> &U, U: 'a + ?Sized,

Implementors§

Source§

impl<'a, D, T> Guard<'a, T> for SingletonGuard<D>
where D: Guard<'a, T>,

Source§

type Mapped<U: 'a + ?Sized> = SingletonGuard<<D as Guard<'a, T>>::Mapped<U>>