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.

Associated Types

The identifier used to uniquely refer to a source. In most cases, this is the fully-qualified path of the file.

Required methods

Get the identifier of the source that this span refers to.

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).

Determine whether the span contains the given offset.

Implementations on Foreign Types

Implementors