Trait chumsky::span::Span [−][src]
pub trait Span: Clone {
type Context: Clone;
type Offset: Clone + Ord;
fn new(context: Self::Context, range: Range<Self::Offset>) -> Self;
fn context(&self) -> Self::Context;
fn start(&self) -> Self::Offset;
fn end(&self) -> Self::Offset;
}
Expand description
A trait that describes a span over a particular range of inputs.
Spans typically consist of some context, such as the file they originated from, and a start/end offset. Spans are permitted to overlap one-another. The end offset must always be greater than or equal to the end offset.
Associated Types
The context that comes packaged with a span. This is usually some way to uniquely identity the source file that
a span originated in. However, it has no inherent meaning to the parser and can be anything. Range<usize>
’s
implementation of Span
simply has a context of ()
.
Required methods
Create a new span given a context and an offset range.