pub struct Location {
pub start: Position,
pub end: Option<Position>,
}
Expand description
Describes a span from start till end in the parsed input.
Start is mandatory while the end is not.
The location doesn’t keep the path of the parsed file on purpose as it will be the same for the single parse tree so it would either unnccessary waste memory, in case of owned strings, or propagate lifetime information throught the API in case of borrowed string slice.
The path is kept on the parsing context and there is the method on the context to produce the display of the location with the full file path.
Fields§
§start: Position
The start position of the range.
end: Option<Position>
The end position. Sometimes it is not known or relevant.
Implementations§
Trait Implementations§
source§impl PartialEq for Location
impl PartialEq for Location
impl Copy for Location
impl Eq for Location
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.