Trait parsel::util::SpannedExt

source ·
pub trait SpannedExt: Spanned {
    // Required methods
    fn format_span(&self) -> SpanDisplay;
    fn byte_range(&self, source: &str) -> Range<usize>;
    fn char_range(&self, source: &str) -> Range<usize>;
}
Expand description

Extension trait for formatting the span of AST nodes in a human-readable manner, and for (re-)computing byte offsets into the source based on the line/column location, since this information is not exposed by the public API of Span.

Required Methods§

source

fn format_span(&self) -> SpanDisplay

source

fn byte_range(&self, source: &str) -> Range<usize>

source

fn char_range(&self, source: &str) -> Range<usize>

Implementors§

source§

impl<T> SpannedExt for T
where T: ?Sized + Spanned,