nvtx
nvtx copied to clipboard
Drop guard API for ranges
Would you be interested in accepting a PR that adds a drop guard API for working with ranges? This would be convenient for cases where a function could return in multiple places and matching range_start!()/range_end!() or range_push!()/range_pop!() is tricky. I'm thinking of an API that would allow the following:
fn example() -> Result<()> {
let _range = nvtx::range!("Hello World!");
fallible_operation()?
if some_condition {
return;
}
Ok(())
// _range goes out of scope and ends the NVTX range
}
If this is something you'd be interested in, I'll open a PR sometime soon.
Yeah, I'd accept this.