# tracing_core::dispatcher::with_default - Rust
API documentation for the Rust `with_default` fn in crate `tracing_core`.
Keywords: rust, rustlang, rust-lang, with_default

# Function tracing_core::dispatcher::with_default [−] [src]

    pub fn with_default<T>(dispatcher: &Dispatch, f: impl FnOnce() -> T) -> T

Sets this dispatch as the default for the duration of a closure.

The default dispatcher is used when creating a new span or `Event`.

ⓘNote

    Note: This function required the Rust standard library.
    no_std users should use
    set_global_default instead.