Skip to main content

val

Macro val 

Source
macro_rules! val {
    ($key:expr) => { ... };
}
Expand description

Value tracking macro that logs key-value pairs to the profiler.

Unlike dbg!, this macro takes a string key and returns a handle with a .set() method. Values are grouped by key (not source location), but each log entry records its source location for debugging.

§Examples

use hotpath::val;

// Track a counter value
hotpath::val!("counter").set(&count);

// Track state changes
hotpath::val!("state").set(&current_state);

// Dynamic keys work too
let key = format!("counter_{}", id);
hotpath::val!(key).set(&value);