Location

Trait Location 

Source
pub trait Location: Clone {
    // Required methods
    fn nowhere() -> Self;
    fn between(start: &Self, end: &Self) -> Self;
}
Expand description

Trait to implement for types representing a source code location

Required Methods§

Source

fn nowhere() -> Self

Create a Location which does not correspond to a source code location. Depending on how the lbirary is used in a compiler, this can either be a placeholder value, in which case encountering a nowhere when reporting an error is probably an error, or if source locations can be missing it should be an actual marker.

Source

fn between(start: &Self, end: &Self) -> Self

Create a location that spans start to end. For example, this is used when creating a loc spanning a parenthesised expression from the start and end parens.

( ... stuff ... )`
^               ^
start           end
^^^^^^^^^^^^^^^^^ <- between

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§