| Crates.io | vacro-trace |
| lib.rs | vacro-trace |
| version | 0.1.2 |
| created_at | 2025-12-29 06:24:43.303264+00 |
| updated_at | 2026-01-06 14:46:34.508444+00 |
| description | Observability, tracing, and snapshot debugging for Rust procedural macros. |
| homepage | |
| repository | https://github.com/FeVeR-Store/vacro |
| max_upload_size | |
| id | 2010046 |
| size | 38,141 |
Observability for Rust Procedural Macros
vacro-trace brings familiar observability tools (logging, tracing, snapshots) to the world of Procedural Macro development.
It acts as the capture layer, designed to work hand-in-hand with vacro-cli (the visualization layer). While vacro-trace records the data, vacro-cli is required to view logs and inspect snapshot diffs.
[dependencies]
vacro-trace = "0.1.2"
The macro entry needs to be marked with #[instrument].
#[instrument]
#[proc_macro]
fn parse_impl(input: proc_macro2::TokenStream) {
// ...
}
Use snapshot!(tag, tokens) to capture the state of tokens at a specific point.
If you take multiple snapshots with the same tag (e.g., "transformation"), vacro-cli will automatically generate a diff view, showing how the tokens evolved.
let mut tokens = quote! { fn hello() {} };
// Initial state
snapshot!("my_macro", tokens);
// ... modify tokens ...
tokens = quote! { fn hello() { println!("world"); } };
// Final state - vacro-cli will show the diff between these two snapshots
snapshot!("my_macro", tokens);
info!("Start expanding macro...");
warn!("Something looks suspicious: {}", "ident_name");