# tracing::span - Rust
API documentation for the Rust `span` macro in crate `tracing`.
Keywords: rust, rustlang, rust-lang, span

# Macro tracing::span [−] [src]

    macro_rules! span {
        (target: $target:expr, parent: $parent:expr, $lvl:expr, $name:expr) => { ... };
        (target: $target:expr, parent: $parent:expr, $lvl:expr, $name:expr, $($fields:tt)*) => { ... };
        (target: $target:expr, $lvl:expr, $name:expr, $($fields:tt)*) => { ... };
        (target: $target:expr, parent: $parent:expr, $lvl:expr, $name:expr) => { ... };
        (parent: $parent:expr, $lvl:expr, $name:expr, $($fields:tt)*) => { ... };
        (parent: $parent:expr, $lvl:expr, $name:expr) => { ... };
        (target: $target:expr, $lvl:expr, $name:expr, $($fields:tt)*) => { ... };
        (target: $target:expr, $lvl:expr, $name:expr) => { ... };
        ($lvl:expr, $name:expr, $($fields:tt)*) => { ... };
        ($lvl:expr, $name:expr) => { ... };
    }

Constructs a new span.

See the top-level documentation for details on the syntax accepted by this macro.

# Examples

Creating a new span:

    let span = span!(Level::TRACE, "my span");
    let _enter = span.enter();
    // do work inside the span...