track_refcell_borrow

Function track_refcell_borrow 

Source
pub fn track_refcell_borrow<'a, T>(
    borrow_id: &str,
    refcell_id: &str,
    location: &str,
    value: Ref<'a, T>,
) -> Ref<'a, T>
Expand description

Track RefCell::borrow operation.

Records a RefCellBorrow event with is_mutable: false. Use this when obtaining a shared borrow from a RefCell.

§Arguments

  • borrow_id - Unique identifier for this borrow
  • refcell_id - Identifier of the RefCell being borrowed
  • location - Source location (e.g., “file.rs:42”)
  • value - The Ref guard (returned unchanged)

§Returns

The input Ref guard, unchanged.

§Examples

use std::cell::RefCell;

let cell = track_refcell_new("cell", RefCell::new(42));
{
    let guard = track_refcell_borrow("borrow1", "cell", "main.rs:10", cell.borrow());
    println!("Value: {}", *guard);
} // guard dropped here