Function rw_cell::cell

source ·
pub fn cell<T>(val: T) -> (CellWriter<T>, CellReader<T>)
Expand description

Create new cell with CellWriter and CellReader Return tuple value and bool value is new or no

Examples

fn main() {
    let (w, mut r) = rw_cell::cell("Not good");
    assert_eq!(r.read(), &"Not good");

    w.write("But ok");
    assert_eq!(r.read_with_is_new(), (&"But ok", true));
}