Trait ilex::Spanned

source ·
pub trait Spanned {
    // Required method
    fn span(&self, ctx: &Context) -> Span;

    // Provided methods
    fn file<'ctx>(&self, ctx: &'ctx Context) -> File<'ctx> { ... }
    fn start(&self, ctx: &Context) -> usize { ... }
    fn end(&self, ctx: &Context) -> usize { ... }
    fn is_empty(&self, ctx: &Context) -> bool { ... }
    fn len(&self, ctx: &Context) -> usize { ... }
    fn text<'ctx>(&self, ctx: &'ctx Context) -> &'ctx str { ... }
    fn comments<'ctx>(&self, ctx: &'ctx Context) -> Comments<'ctx> { ... }
}
Expand description

A syntax element which contains a span.

You should implement this type for any type which naturally has a single span that describes it.

Required Methods§

source

fn span(&self, ctx: &Context) -> Span

Returns the span in this syntax element.

Provided Methods§

source

fn file<'ctx>(&self, ctx: &'ctx Context) -> File<'ctx>

Forwards to SpanId::file().

source

fn start(&self, ctx: &Context) -> usize

Forwards to Span::start().

source

fn end(&self, ctx: &Context) -> usize

Forwards to Span::end().

source

fn is_empty(&self, ctx: &Context) -> bool

Forwards to Span::is_empty().

source

fn len(&self, ctx: &Context) -> usize

Forwards to Span::len().

source

fn text<'ctx>(&self, ctx: &'ctx Context) -> &'ctx str

Forwards to SpanId::text().

source

fn comments<'ctx>(&self, ctx: &'ctx Context) -> Comments<'ctx>

Forwards to SpanId::comments().

Implementations on Foreign Types§

source§

impl<S: Spanned> Spanned for &S

source§

fn span(&self, ctx: &Context) -> Span

Implementors§