Skip to main content

Guarded

Trait Guarded 

Source
pub trait Guarded<T>
where T: ?Sized,
{ type Guard<'a>: Deref<Target = T> where Self: 'a; // Required method fn get<'a>(&'a self) -> Self::Guard<'a>; }

Required Associated Types§

Source

type Guard<'a>: Deref<Target = T> where Self: 'a

Required Methods§

Source

fn get<'a>(&'a self) -> Self::Guard<'a>

Can panic on exceptional behavior (ex poisoned mutex)

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<T> Guarded<T> for RefCell<T>

Available on crate feature std only.
Source§

type Guard<'a> = Ref<'a, T> where RefCell<T>: 'a

Source§

fn get<'a>(&'a self) -> <RefCell<T> as Guarded<T>>::Guard<'a>

Source§

impl<T> Guarded<T> for Mutex<T>

Available on crate feature std only.
Source§

type Guard<'a> = MutexGuard<'a, T> where Mutex<T>: 'a

Source§

fn get<'a>(&'a self) -> <Mutex<T> as Guarded<T>>::Guard<'a>

Source§

impl<T> Guarded<T> for RwLock<T>

Available on crate feature std only.
Source§

type Guard<'a> = RwLockReadGuard<'a, T> where RwLock<T>: 'a

Source§

fn get<'a>(&'a self) -> <RwLock<T> as Guarded<T>>::Guard<'a>

Implementors§