pub struct Location { /* private fields */ }Expand description
Either references a location in the original source file,
or is Location::MISSING.
A location has a total order based on the byte offset,
with Location::MISSING coming after every valid location.
Implementations§
Source§impl Location
impl Location
Sourcepub const MISSING: Location
pub const MISSING: Location
Indicates that the location information is missing, and doesn’t correspond to a known location in the source file.
For the purposes of a comparison using Ord,
a missing value comes after all present values.
Sourcepub const fn is_missing(self) -> bool
pub const fn is_missing(self) -> bool
Determine if the location is Self::MISSING.
Sourcepub const fn byte_offset(self) -> Result<u64, MissingLocationError>
pub const fn byte_offset(self) -> Result<u64, MissingLocationError>
Return the byte offset of this location,
or a MissingLocationError if missing.
Sourcepub fn to_span(self) -> Span
pub fn to_span(self) -> Span
A span which points only to this location.
Returns Span::MISSING if this location is missing.
Trait Implementations§
Source§impl From<ByteLocation> for Location
impl From<ByteLocation> for Location
Source§fn from(location: ByteLocation) -> Self
fn from(location: ByteLocation) -> Self
Converts to this type from the input type.
Source§impl From<Location> for ByteLocation
impl From<Location> for ByteLocation
Source§impl Ord for Location
impl Ord for Location
Source§impl PartialOrd for Location
impl PartialOrd for Location
impl Copy for Location
impl Eq for Location
Auto Trait Implementations§
impl Freeze for Location
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.