pub trait Spanned {
// Required methods
fn span(&self) -> Span;
fn set_span(&mut self, span: Span);
// Provided method
fn with_span(self, span: Span) -> Self
where Self: Sized { ... }
}
Expand description
A trait that can provide the Span
of the complete contents of a syntax
tree node.
The main difference between this trait and syn::spanned::Spanned
is that
this trait does not depend on a quote::ToTokens
implementation to
retrieve a span, as it is usually stored inside of the syntax tree node
itself.
Required Methods§
Sourcefn span(&self) -> Span
fn span(&self) -> Span
Returns a Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.