macro_rules! define_with {
($shared:expr) => { ... };
}Expand description
Convenience macro for invoking Shared::with() method.
let mut shared_data = Rc::new(RefCell::new(vec![1, 2, 3]));
define_with!(shared_data);
with!(|data| data.push(42));
let copy: Vec<_> = with!(|data| data.clone());
assert_eq!(copy, vec![1, 2, 3, 42]);