Skip to main content
The #[trace] attribute macro instruments a function so that every call appears as a node in the dbgflow execution graph. When the function is called, dbgflow records entry, captures previews of all arguments, and records the return event. You can then inspect this data in the browser UI or during test playback.

Usage

Add #[trace] directly above any fn item:

Arguments

string
Optional display label shown in the browser UI. Defaults to the function name as written in source.

What gets captured

For every call to a traced function, dbgflow records three things:
Argument previews use Debug formatting. Any type passed as an argument must implement Debug for its preview to be captured. Types that do not implement Debug will show <non-ident pattern> in the UI instead.

Example

The following example shows basic usage alongside a named override:

Notes on Debug requirements

  • Primitive types (u32, &str, bool, etc.) implement Debug by default.
  • Standard library types like Vec<T>, Option<T>, and Result<T, E> implement Debug when their type parameters do.
  • Your own types need #[derive(Debug)] or a manual Debug implementation. If you also annotate them with #[ui_debug], Debug is derived automatically.
  • self receivers are always captured as "self" in the preview — the Self type must implement Debug.
If a traced function takes a type that does not implement Debug, your code will fail to compile. Add #[derive(Debug)] to the type or implement Debug manually before adding #[trace].