Skip to main content

span_scope_named_dyn

Macro span_scope_named_dyn 

Source
macro_rules! span_scope_named_dyn {
    ($static_var_name:ident, $name:expr) => { ... };
    ($name:expr) => { ... };
}
Expand description

Records a span whose name is built at runtime, such as format!(..) or a &String. The name is copied into each block that records one of the span’s events, so a high number of distinct names does not accumulate in memory. The guard owns the name, which is kept alive until the end of the scope.

§Examples

use micromegas_tracing::span_scope_named_dyn;

let asset = String::from("hero.png");
span_scope_named_dyn!(format!("load {asset}"));