track_refcell_new

Function track_refcell_new 

Source
pub fn track_refcell_new<T>(name: &str, value: RefCell<T>) -> RefCell<T>
Expand description

Track RefCell::new allocation.

Records a RefCellNew event. Use this when creating a new RefCell for interior mutability.

§Arguments

  • name - A descriptive name for the RefCell
  • value - The RefCell being tracked (returned unchanged)

§Returns

The input RefCell, unchanged.

§Examples

use std::cell::RefCell;

let cell = track_refcell_new("cell", RefCell::new(42));

let events = get_events();
assert!(events[0].is_refcell());