Provides an attribute-macro trace
to help get rid of boilerplate.
toml
[dependencies]
minitrace = "0.4" # minitrace-macro is within minitrace::prelude
```rust use minitrace::prelude::*;
fn foo() { // function body }
// * WILL BE TRANSLATED INTO: * // // fn foo() { // let _guard = LocalSpan::enterwithlocalparent("foo"); // { // // function body // } // } ```
```rust use minitrace::prelude::*;
async fn bar() { // function body }
// * WILL BE TRANSLATED INTO: * // // fn bar() -> impl core::future::Future
async fn qux() { // function body }
// * WILL BE TRANSLATED INTO: * // // fn qux() -> impl core::future::Future
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()
.
```rust use minitrace::prelude::*;
fn foo() {}
async fn bar() {}
let (root, collector) = Span::root("root");
{
foo(); // This foo
will not be traced.
}
{
let g = root.setlocal_parent();
foo(); // This foo
will be traced.
}
{
runtime::spawn(bar()); // This bar
will not be traced.
}
{
let g = root.setlocal_parent();
runtime::spawn(bar()); // This bar
will be traced.
}
```
This Crate adopts the Ferrous Systems proc-macro pipeline:
To see a list of all tests:
bash
pushd minitest-macro
cargo test -- --list
popd
To run an individual test suite, say the ui
suite:
bash
cargo test ui -- --nocapture