#procedural #macro #quote

quote_precise

A quote implementation that preserves meaningful span locations

8 releases

0.0.9 Mar 9, 2021
0.0.8 Jul 24, 2020

#220 in Procedural macros

43 downloads per month

MIT/Apache

7KB

quote_precise

A version of quote that preserves Span locations

//junk Spans
let t: Token![!] = parse_quote! { ! };
println!("{:?}:{:?}-{:?}", t.span, t.span.start(), t.span.end());

//useful Spans
let t: Token![!] = parse_quote_precise! { ! };
println!("{:?}:{:?}-{:?}", t.span, t.span.start(), t.span.end());
assert_ne!(
   t.span.start(),
   t.span.end()
)

Waiting on proc_macro::Span to stabilize a bit more to see if further work on this crate is not entirely redundant effort.

Dependencies

~110KB