pub struct SourceLocation { /* private fields */ }Implementations§
Source§impl SourceLocation
impl SourceLocation
pub fn into_internal(self) -> Self
Sourcepub fn undefined() -> SourceLocation
pub fn undefined() -> SourceLocation
Constructs an undefined SourceRange with a 0..0 range and no filename
Sourcepub fn get_line(&self) -> usize
pub fn get_line(&self) -> usize
Gets the line representation for a source location If the location does not represent a line, the closest equivalent is returned That is 0 for None and the ID for id/inner spans
Sourcepub fn get_line_end(&self) -> usize
pub fn get_line_end(&self) -> usize
Gets the line representation for a source location If the location does not represent a line, the closest equivalent is returned That is 0 for None and the ID for id/inner spans
Sourcepub fn get_line_plus_one(&self) -> usize
pub fn get_line_plus_one(&self) -> usize
Same as [get_line] but adds one to the line number if its of type CodeSpan::Range.
Sourcepub fn get_column(&self) -> usize
pub fn get_column(&self) -> usize
Gets the colmumn representation for a source location If the location does not represent a line, 0 is returned
Sourcepub fn get_column_end(&self) -> usize
pub fn get_column_end(&self) -> usize
Gets the colmumn representation for a source location If the location does not represent a line, 0 is returned
Sourcepub fn span(&self, other: &SourceLocation) -> SourceLocation
pub fn span(&self, other: &SourceLocation) -> SourceLocation
returns a new SourceRange that spans this and the other range.
In other words this results in self.start .. other.end
pub fn get_file_name(&self) -> Option<&'static str>
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
returns true if this SourceRange points to an undefined location.
see SourceRange::undefined()
pub fn get_span(&self) -> &CodeSpan
pub fn replace_with(&mut self, new_location: SourceLocation)
Sourcepub fn internal() -> Self
pub fn internal() -> Self
creates a SymbolLocation with undefined source_range used for symbols that are created by the compiler on-the-fly.
Sourcepub fn internal_in_unit(unit: Option<&'static str>) -> Self
pub fn internal_in_unit(unit: Option<&'static str>) -> Self
creates an internal SymbolLocation but specifies the CompilationUnit/File it was encountered in. This can be necessary when checking if dependencies are located within the same unit as the internally generated element
pub fn is_internal(&self) -> bool
pub fn is_builtin_internal(&self) -> bool
pub fn is_in_unit(&self, unit: impl AsRef<str>) -> bool
Trait Implementations§
Source§impl Clone for SourceLocation
impl Clone for SourceLocation
Source§fn clone(&self) -> SourceLocation
fn clone(&self) -> SourceLocation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceLocation
impl Debug for SourceLocation
Source§impl Default for SourceLocation
impl Default for SourceLocation
Source§impl<'de> Deserialize<'de> for SourceLocationwhere
'de: 'static,
impl<'de> Deserialize<'de> for SourceLocationwhere
'de: 'static,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SourceLocation
impl Display for SourceLocation
Source§impl From<&SourceLocation> for SourceLocation
impl From<&SourceLocation> for SourceLocation
Source§fn from(value: &SourceLocation) -> Self
fn from(value: &SourceLocation) -> Self
Source§impl Hash for SourceLocation
impl Hash for SourceLocation
Source§impl PartialEq for SourceLocation
impl PartialEq for SourceLocation
Source§fn eq(&self, other: &SourceLocation) -> bool
fn eq(&self, other: &SourceLocation) -> bool
self and other values to be equal, and is used by ==.