spanr 0.1.0

A tool for proc-macro authors to visualize the spans on generated code.
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 313.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 281.17 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Diggsey

spanr

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

Screenshot

screenshot

Example usage

#[proc_macro_attribute]
pub fn act_zero(_attr: TokenStream, item: TokenStream) -> TokenStream {
    let res = match act_zero_impl(item) {
        Ok(tokens) => tokens,
        Err(e) => e.to_compile_error(),
    };
    // 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:

RUSTFLAGS='--cfg procmacro2_semver_exempt'