#[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
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.) implementDebugby default. - Standard library types like
Vec<T>,Option<T>, andResult<T, E>implementDebugwhen their type parameters do. - Your own types need
#[derive(Debug)]or a manualDebugimplementation. If you also annotate them with#[ui_debug],Debugis derived automatically. selfreceivers are always captured as"self"in the preview — theSelftype must implementDebug.