minitrace-macro
Provides an attribute-macro trace to help get rid of boilerplate.
Usage
Dependency
[]
= "0.3" # minitrace-macro is within minitrace::prelude
Synchronous Function
use *;
// ** WILL BE TRANSLATED INTO: **
//
// fn foo() {
// let __guard = LocalSpan::enter_with_local_parent("foo");
// {
// // function body
// }
// }
Asynchronous Function
use *;
async
// ** WILL BE TRANSLATED INTO: **
//
// fn bar() -> impl core::future::Future<Output = ()> {
// async {
// // function body
// }
// .in_span(Span::enter_with_local_parent("bar"))
// }
async
// ** WILL BE TRANSLATED INTO: **
//
// fn qux() -> impl core::future::Future<Output = ()> {
// async {
// // function body
// }
// .enter_on_poll("qux")
// }
⚠️ Local Parent Needed
A function instrumented by trace always require a local parent in the context. Make sure that the caller is within the scope of Span::set_local_parent().
use *;
async
let = root;