timetrap
Lightweight Rust macros for timing and memory/swap measurement.
All macros return the wrapped expression result as-is (R), so they can be used inline without changing function behavior.
Install
trap! (time only)
use *;
let count = trap!;
assert_eq!;
trap_mem! (time + memory/swap)
use *;
let map = trap_mem!;
assert_eq!;
Colored Output
use *;
trap!;
trap_mem!;
Color is printed only when stdout is a TTY and NO_COLOR is not set.