Skip to main content

Crate quote_respanned

Crate quote_respanned 

Source
Expand description

A crate for easily changing the span for TokenTrees, possibly recursing over Groups, usable with quote.

use proc_macro2::{
	Ident,
	Span,
};
use quote_respanned::QuoteRespanned;

let my_ident = Ident::new("my_variable", Span::call_site());

let original = quote::quote! {
	fn my_function() {
		let #my_ident = 42;
	}
};

// Now everything, including `my_ident`, will have the mixed_site span.
QuoteRespanned::new(original, Span::mixed_site());

Structs§

QuoteRelocatedhas_span_resolution
Changes the resolution site for Spans.
QuoteRelocatedIterhas_span_resolution
This iterator is used by QuoteRelocated .
QuoteReresolvedhas_span_resolution
Changes the resolution site for Spans.
QuoteReresolvedIterhas_span_resolution
This iterator is used by QuoteReresolved .
QuoteRespanned
Replaces the span entirely.
QuoteRespannedIter
This iterator is used by QuoteRespanned .

Functions§

relocatehas_span_resolution
Changes the resolution site for Spans.
reresolvehas_span_resolution
Changes the resolution site for Spans.
respan
Replaces the span entirely.