pub trait WithLocation<L: Location>: Sized {
// Provided methods
fn at(self, span: impl Into<L>) -> Loc<Self, L>
where Self: Sized { ... }
fn at_loc<T: Sized>(self, loc: &Loc<T, L>) -> Loc<Self, L> { ... }
fn between(self, start: impl Into<L>, end: impl Into<L>) -> Loc<Self, L> { ... }
fn between_locs<T, Y>(
self,
start: &Loc<T, L>,
end: &Loc<Y, L>,
) -> Loc<Self, L> { ... }
fn nowhere(self) -> Loc<Self, L>
where Self: Sized { ... }
}Provided Methods§
Sourcefn at_loc<T: Sized>(self, loc: &Loc<T, L>) -> Loc<Self, L>
fn at_loc<T: Sized>(self, loc: &Loc<T, L>) -> Loc<Self, L>
Creates a new Loc at the same source code location as another Loc
Sourcefn between(self, start: impl Into<L>, end: impl Into<L>) -> Loc<Self, L>
fn between(self, start: impl Into<L>, end: impl Into<L>) -> Loc<Self, L>
Create a location that spans start and end
Sourcefn between_locs<T, Y>(self, start: &Loc<T, L>, end: &Loc<Y, L>) -> Loc<Self, L>
fn between_locs<T, Y>(self, start: &Loc<T, L>, end: &Loc<Y, L>) -> Loc<Self, L>
Create a location that spans start and end
Sourcefn nowhere(self) -> Loc<Self, L>where
Self: Sized,
fn nowhere(self) -> Loc<Self, L>where
Self: Sized,
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.
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.