Skip to content

enter! macro #158

Open
Open
@yaahc

Description

@yaahc

Right now there is some mandatory boilerplate whenever using span!.

let span = span!(...);
let _something = span.enter();

It cannot be written as

span!(...).enter(); // temporary value freed at end of statement

// or

let span = span!(...);
let _ = span.enter(); // silently fails to do anything, guard is dropped immediately here

In order for it to work you must bind the span to a temporary and you must bind the guard to another ignored temporary and that cannot be _ because of rust drop semantics.

The Idea

Here enters the enter! macro.

enter!(span!(...));

which should just expand to the first example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions