spanr

A tool for procedural macro authors to be able to interactively view and debug the Spans on generated code.

Screenshot

screenshot

Example usage

```rust

[procmacroattribute]

pub fn actzero(attr: TokenStream, item: TokenStream) -> TokenStream { let res = match actzeroimpl(item) { Ok(tokens) => tokens, Err(e) => e.tocompileerror(), }; // Save the visualization to a file spanr::save_html(res.clone(), "tokens.html").unwrap(); res.into() } ```

Building

This crate relies on unstable features from the proc-macro2 crate, so it must be built using a nightly compiler, and the RUSTFLAGS environment variable must be configured:

bash RUSTFLAGS='--cfg procmacro2_semver_exempt'