pub trait WithContainer<Root, Value> {
Show 16 methods
// Required methods
fn with_arc<F, R>(self, arc: &Arc<Root>, f: F) -> R
where F: FnOnce(&Value) -> R;
fn with_box<F, R>(self, boxed: &Box<Root>, f: F) -> R
where F: FnOnce(&Value) -> R;
fn with_box_mut<F, R>(self, boxed: &mut Box<Root>, f: F) -> R
where F: FnOnce(&mut Value) -> R;
fn with_rc<F, R>(self, rc: &Rc<Root>, f: F) -> R
where F: FnOnce(&Value) -> R;
fn with_result<F, R, E>(self, result: &Result<Root, E>, f: F) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_result_mut<F, R, E>(
self,
result: &mut Result<Root, E>,
f: F,
) -> Option<R>
where F: FnOnce(&mut Value) -> R;
fn with_option<F, R>(self, option: &Option<Root>, f: F) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_option_mut<F, R>(self, option: &mut Option<Root>, f: F) -> Option<R>
where F: FnOnce(&mut Value) -> R;
fn with_refcell<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_refcell_mut<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>
where F: FnOnce(&mut Value) -> R;
fn with_mutex<F, R>(self, mutex: &Mutex<Root>, f: F) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_mutex_mut<F, R>(self, mutex: &mut Mutex<Root>, f: F) -> Option<R>
where F: FnOnce(&mut Value) -> R;
fn with_rwlock<F, R>(self, rwlock: &RwLock<Root>, f: F) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_rwlock_mut<F, R>(self, rwlock: &mut RwLock<Root>, f: F) -> Option<R>
where F: FnOnce(&mut Value) -> R;
fn with_arc_rwlock<F, R>(
self,
arc_rwlock: &Arc<RwLock<Root>>,
f: F,
) -> Option<R>
where F: FnOnce(&Value) -> R;
fn with_arc_rwlock_mut<F, R>(
self,
arc_rwlock: &Arc<RwLock<Root>>,
f: F,
) -> Option<R>
where F: FnOnce(&mut Value) -> R;
}Expand description
Trait for no-clone callback-based access to container types Provides methods to execute closures with references to values inside containers without requiring cloning of the values
Required Methods§
Sourcefn with_arc<F, R>(self, arc: &Arc<Root>, f: F) -> R
fn with_arc<F, R>(self, arc: &Arc<Root>, f: F) -> R
Execute a closure with a reference to the value inside an Arc This avoids cloning by working with references directly
Sourcefn with_box<F, R>(self, boxed: &Box<Root>, f: F) -> R
fn with_box<F, R>(self, boxed: &Box<Root>, f: F) -> R
Execute a closure with a reference to the value inside a Box This avoids cloning by working with references directly
Sourcefn with_box_mut<F, R>(self, boxed: &mut Box<Root>, f: F) -> Rwhere
F: FnOnce(&mut Value) -> R,
fn with_box_mut<F, R>(self, boxed: &mut Box<Root>, f: F) -> Rwhere
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside a Box This avoids cloning by working with references directly
Sourcefn with_rc<F, R>(self, rc: &Rc<Root>, f: F) -> R
fn with_rc<F, R>(self, rc: &Rc<Root>, f: F) -> R
Execute a closure with a reference to the value inside an Rc This avoids cloning by working with references directly
Sourcefn with_result<F, R, E>(self, result: &Result<Root, E>, f: F) -> Option<R>
fn with_result<F, R, E>(self, result: &Result<Root, E>, f: F) -> Option<R>
Execute a closure with a reference to the value inside a Result This avoids cloning by working with references directly
Sourcefn with_result_mut<F, R, E>(
self,
result: &mut Result<Root, E>,
f: F,
) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_result_mut<F, R, E>(
self,
result: &mut Result<Root, E>,
f: F,
) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside a Result This avoids cloning by working with references directly
Sourcefn with_option<F, R>(self, option: &Option<Root>, f: F) -> Option<R>
fn with_option<F, R>(self, option: &Option<Root>, f: F) -> Option<R>
Execute a closure with a reference to the value inside an Option This avoids cloning by working with references directly
Sourcefn with_option_mut<F, R>(self, option: &mut Option<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_option_mut<F, R>(self, option: &mut Option<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside an Option This avoids cloning by working with references directly
Sourcefn with_refcell<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>
fn with_refcell<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>
Execute a closure with a reference to the value inside a RefCell This avoids cloning by working with references directly
Sourcefn with_refcell_mut<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_refcell_mut<F, R>(self, refcell: &RefCell<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside a RefCell This avoids cloning by working with references directly
Sourcefn with_mutex<F, R>(self, mutex: &Mutex<Root>, f: F) -> Option<R>
fn with_mutex<F, R>(self, mutex: &Mutex<Root>, f: F) -> Option<R>
Execute a closure with a reference to the value inside a Mutex This avoids cloning by working with references while the guard is alive
Sourcefn with_mutex_mut<F, R>(self, mutex: &mut Mutex<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_mutex_mut<F, R>(self, mutex: &mut Mutex<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside a Mutex This avoids cloning by working with references while the guard is alive
Sourcefn with_rwlock<F, R>(self, rwlock: &RwLock<Root>, f: F) -> Option<R>
fn with_rwlock<F, R>(self, rwlock: &RwLock<Root>, f: F) -> Option<R>
Execute a closure with a reference to the value inside an RwLock This avoids cloning by working with references while the guard is alive
Sourcefn with_rwlock_mut<F, R>(self, rwlock: &mut RwLock<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_rwlock_mut<F, R>(self, rwlock: &mut RwLock<Root>, f: F) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside an RwLock This avoids cloning by working with references while the guard is alive
Sourcefn with_arc_rwlock<F, R>(
self,
arc_rwlock: &Arc<RwLock<Root>>,
f: F,
) -> Option<R>
fn with_arc_rwlock<F, R>( self, arc_rwlock: &Arc<RwLock<Root>>, f: F, ) -> Option<R>
Execute a closure with a reference to the value inside an Arc<RwLock
Sourcefn with_arc_rwlock_mut<F, R>(
self,
arc_rwlock: &Arc<RwLock<Root>>,
f: F,
) -> Option<R>where
F: FnOnce(&mut Value) -> R,
fn with_arc_rwlock_mut<F, R>(
self,
arc_rwlock: &Arc<RwLock<Root>>,
f: F,
) -> Option<R>where
F: FnOnce(&mut Value) -> R,
Execute a closure with a mutable reference to the value inside an Arc<RwLock
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.