Trait WithBorrow

Source
pub trait WithBorrow<'a, O> {
    // Required methods
    fn with_borrow<F, R>(&'a self, f: F) -> R
       where F: FnOnce(&O) -> R;
    fn with_borrow_mut<F, R>(&'a self, f: F) -> R
       where F: FnOnce(&mut O) -> R;
}

Required Methods§

Source

fn with_borrow<F, R>(&'a self, f: F) -> R
where F: FnOnce(&O) -> R,

Source

fn with_borrow_mut<F, R>(&'a self, f: F) -> R
where F: FnOnce(&mut O) -> R,

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, O> WithBorrow<'a, O> for Mutex<O>

Source§

fn with_borrow<F, R>(&self, f: F) -> R
where F: FnOnce(&O) -> R,

Source§

fn with_borrow_mut<F, R>(&self, f: F) -> R
where F: FnOnce(&mut O) -> R,

Source§

impl<'a, O> WithBorrow<'a, O> for RwLock<O>

Source§

fn with_borrow<F, R>(&self, f: F) -> R
where F: FnOnce(&O) -> R,

Source§

fn with_borrow_mut<F, R>(&self, f: F) -> R
where F: FnOnce(&mut O) -> R,

Source§

impl<O> WithBorrow<'static, O> for LocalKey<RefCell<O>>

Source§

fn with_borrow<F, T>(&'static self, f: F) -> T
where F: FnOnce(&O) -> T,

Source§

fn with_borrow_mut<F, T>(&'static self, f: F) -> T
where F: FnOnce(&mut O) -> T,

Implementors§