Skip to content

Provide Span method into_enter #192

@singpolyma-shopify

Description

@singpolyma-shopify

Feature Request

Motivation

It is a common case to create a span, enter it right away, and then never use it again.

Proposal

Provide a method on span into_enter which is the same as the current enter but consumes self rather than taking a reference to it. This would allow the following code:

let _myspan_enter = info_span!("myspan").into_enter();
...

as opposed to the currently required:

let myspan = info_span!("myspan");
let _myspan_enter = myspan.enter();

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate/tracingRelated to the `tracing` cratekind/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions