[][src]Macro thorium::tlc_modify

macro_rules! tlc_modify {
    ($cell_name:ident, $modify_func:expr) => { ... };
}

Modify a thread_local Cell with the provided function.

use core::cell::Cell;
use thorium::{tlc_read, tlc_modify};

thread_local! {
  static VAL: Cell<i32> = Cell::new(3);
}
fn main() {
  tlc_modify!(VAL, |v| v + 2);
  assert_eq!(tlc_read!(VAL), 5);
}