typst_timing

Macro timed

source
macro_rules! timed {
    ($name:expr, span = $span:expr, $body:expr $(,)?) => { ... };
    ($name:expr, $body:expr $(,)?) => { ... };
}
Expand description

Creates a timing scope around an expression.

The output of the expression is returned.

The scope will be named name and will have the span span. The span is optional.

ยงExample

// With a scope name and span.
timed!(
    "my scope",
    span = Span::detached(),
    std::thread::sleep(std::time::Duration::from_secs(1)),
);

// With a scope name and no span.
timed!(
    "my scope",
    std::thread::sleep(std::time::Duration::from_secs(1)),
);