Function debug_span

Source
pub fn debug_span(span: impl Span, code: &str) -> String
Expand description

Generate a debug representation of a span and the source code it points to.

It accepts any type that implements the Span trait. Span is implemented for proc_macro2::Span.

§Single line span example

 --> 1:7..1:10
  |
1 | struct Foo;
  |        ^^^

§Multi line span example

--> 1:11..4:1
  |
  |            ┌────╮
1 | struct Foo {    │
2 |     a: i32,     │
3 |     b: i32,     │
4 | }               │
  | └───────────────╯