Skip to main content

SourceLocation

Struct SourceLocation 

Source
pub struct SourceLocation { /* private fields */ }

Implementations§

Source§

impl SourceLocation

Source

pub fn into_internal(self) -> Self

Source

pub fn undefined() -> SourceLocation

Constructs an undefined SourceRange with a 0..0 range and no filename

Source

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

Source

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

Source

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.

Source

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

Source

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

Source

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

Source

pub fn to_range(&self) -> Option<Range<usize>>

converts this SourceRange into a Range

Source

pub fn get_file_name(&self) -> Option<&'static str>

Source

pub fn is_undefined(&self) -> bool

returns true if this SourceRange points to an undefined location. see SourceRange::undefined()

Source

pub fn get_span(&self) -> &CodeSpan

Source

pub fn replace_with(&mut self, new_location: SourceLocation)

Source

pub fn internal() -> Self

creates a SymbolLocation with undefined source_range used for symbols that are created by the compiler on-the-fly.

Source

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

Source

pub fn is_internal(&self) -> bool

Source

pub fn is_builtin_internal(&self) -> bool

Source

pub fn is_in_unit(&self, unit: impl AsRef<str>) -> bool

Trait Implementations§

Source§

impl Clone for SourceLocation

Source§

fn clone(&self) -> SourceLocation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SourceLocation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SourceLocation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SourceLocation
where 'de: 'static,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for SourceLocation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&SourceLocation> for SourceLocation

Source§

fn from(value: &SourceLocation) -> Self

Converts to this type from the input type.
Source§

impl Hash for SourceLocation

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SourceLocation

Source§

fn eq(&self, other: &SourceLocation) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SourceLocation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for SourceLocation

Source§

impl StructuralPartialEq for SourceLocation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,