Trait chumsky::span::Span[][src]

pub trait Span: Clone {
    type Context: Clone;
    type Offset: Clone;
    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 ().

A type representing a span’s start or end offset. Typically, usize is used.

Required methods

Create a new span given a context and an offset range.

Return the span’s context.

Return the start offset of the span.

Return the end offset of the span.

Implementations on Foreign Types

Implementors