pub fn track_rc_clone<T: ?Sized>(
name: &str,
source_name: &str,
value: Rc<T>,
) -> Rc<T>Expand description
Track Rc::clone operation.
Records an RcClone event with the updated reference counts.
Use this when cloning an Rc to share ownership.
§Arguments
name- A descriptive name for the new clonesource_name- Name of the Rc being cloned fromvalue- The cloned Rc (returned unchanged)
§Returns
The input Rc, unchanged.
§Examples
use std::rc::Rc;
let original = track_rc_new("original", Rc::new(42));
let clone1 = track_rc_clone("clone1", "original", Rc::clone(&original));
let clone2 = track_rc_clone("clone2", "original", Rc::clone(&original));
assert_eq!(Rc::strong_count(&original), 3);
let events = get_events();
assert_eq!(events[1].strong_count(), Some(2)); // After first clone
assert_eq!(events[2].strong_count(), Some(3)); // After second clone