Skip to content
/ spanr Public

Procedural macro span debugger/visualizer

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt
Notifications You must be signed in to change notification settings

Diggsey/spanr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Procedural macro span debugger/visualizer

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published