StemCellBehavior

Trait StemCellBehavior 

Source
pub trait StemCellBehavior<T> {
    // Required methods
    fn new(t: T) -> Self
       where Self: Sized;
    fn map_ref<F, R>(&self, f: F) -> R
       where F: for<'a> FnMut(&'a T) -> R;
    fn map_mut<F, R>(&self, f: F) -> R
       where F: for<'a> FnMut(&'a mut T) -> R;
}
Expand description

A mutable memory location

This is used to back the behavior of Stem, which should be used instead of this trait.

Required Methods§

Source

fn new(t: T) -> Self
where Self: Sized,

Create an instance of Self

Source

fn map_ref<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a T) -> R,

Map a reference to T to a new type

Implementors may choose to panic or block if map_mut called concurrently.

Source

fn map_mut<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a mut T) -> R,

Map a mutable reference to T to a new type

Implementors may choose to panic or block if map_ref or map_mut called concurrently.

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

Source§

fn new(t: T) -> Self

Source§

fn map_ref<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a T) -> R,

Source§

fn map_mut<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a mut T) -> R,

Source§

impl<T> StemCellBehavior<T> for RwLock<T>

Available on crate feature std only.
Source§

fn new(t: T) -> Self

Source§

fn map_ref<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a T) -> R,

Source§

fn map_mut<F, R>(&self, f: F) -> R
where F: for<'a> FnMut(&'a mut T) -> R,

Implementors§