track_drop

Function track_drop 

Source
pub fn track_drop(name: &str)
Expand description

Track a variable going out of scope.

Records a Drop event. Call this when a variable’s lifetime ends. Unlike other tracking functions, this doesn’t return a value since the variable is being destroyed.

§Arguments

  • name - Name of the variable being dropped

§Examples

{
    let x = track_new("x", 42);
    // x goes out of scope here
    track_drop("x");
}

let events = get_events();
assert!(events[1].is_drop());

§Note

For automatic drop tracking, consider using RAII guards or the future borrowscope-macro crate which will instrument drops automatically.