track_cell_new

Function track_cell_new 

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

Track Cell::new allocation.

Records a CellNew event. Use this when creating a new Cell for interior mutability with Copy types.

§Arguments

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

§Returns

The input Cell, unchanged.

§Examples

use std::cell::Cell;

let counter = track_cell_new("counter", Cell::new(0));

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