pub trait Span {
type SourceId: PartialEq + ToOwned + ?Sized;
fn source(&self) -> &Self::SourceId;
fn start(&self) -> usize;
fn end(&self) -> usize;
fn len(&self) -> usize { ... }
fn contains(&self, offset: usize) -> bool { ... }
}
Expand description
A trait implemented by spans within a character-based source.
Required Associated Types
Required Methods
Get the start offset of this span.
Offsets are zero-indexed character offsets from the beginning of the source.
Get the (exclusive) end offset of this span.
The end offset should always be greater than or equal to the start offset as given by Span::start
.
Offsets are zero-indexed character offsets from the beginning of the source.
Provided Methods
Get the length of this span (difference between the start of the span and the end of the span).