pub trait Span {
type SourceId: PartialEq + ToOwned + ?Sized;
// Required methods
fn source(&self) -> &Self::SourceId;
fn start(&self) -> usize;
fn end(&self) -> usize;
// Provided methods
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§
sourcefn start(&self) -> usize
fn start(&self) -> usize
Get the start offset of this span.
Offsets are zero-indexed character offsets from the beginning of the source.
sourcefn end(&self) -> usize
fn end(&self) -> usize
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§
Object Safety§
This trait is not object safe.