Skip to main content

profile_function

Function profile_function 

Source
pub fn profile_function<T>(
    tag: impl Into<String>,
    function: impl FnOnce() -> T,
) -> T
Expand description

Run a function or closure under a profiling tag and return its result.

This is the Rust counterpart to Reticulum’s profiling decorator. Rust does not expose a stable runtime qualified function name, so the tag is explicit. The guard is also dropped during unwinding, preserving completed timing for functions that panic when the panic is caught by their caller.