Span

Trait Span 

Source
pub trait Span: Clone {
    type Uri: PartialEq + Clone + Display;
    type Source: AsRef<str> + Clone;
    type Index: Indexer + ?Sized;

    // Required methods
    fn start(&self) -> usize;
    fn end(&self) -> usize;
    fn source_text(&self) -> &Self::Source;
    fn source_index(&self) -> &Self::Index;
    fn uri(&self) -> &Self::Uri;

    // Provided method
    fn range(&self) -> Range<usize> { ... }
}
Expand description

Trait for span types used in error enums.

Required Associated Types§

Source

type Uri: PartialEq + Clone + Display

The URI type for the span.

Source

type Source: AsRef<str> + Clone

The source text type for the span.

Source

type Index: Indexer + ?Sized

The index of the source text.

Required Methods§

Source

fn start(&self) -> usize

Get the start position of the span.

Source

fn end(&self) -> usize

Get the end position of the span.

Source

fn source_text(&self) -> &Self::Source

Get the source text of the span.

Source

fn source_index(&self) -> &Self::Index

Get the index of the source.

Source

fn uri(&self) -> &Self::Uri

Get the URI of the span.

Provided Methods§

Source

fn range(&self) -> Range<usize>

Get the range of the span.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§