Location

Struct Location 

Source
pub struct Location<'c> { /* private fields */ }
Expand description

A location

Implementations§

Source§

impl<'c> Location<'c>

Source

pub fn new( context: &'c Context, filename: &str, line: usize, column: usize, ) -> Self

Creates a location with a filename and line and column numbers.

Source

pub fn fused( context: &'c Context, locations: &[Self], attribute: Attribute<'_>, ) -> Self

Creates a fused location.

Source

pub fn name(context: &'c Context, name: &str, child: Location<'_>) -> Self

Creates a name location.

Source

pub fn call_site(callee: Location<'_>, caller: Location<'_>) -> Self

Creates a call site location.

Source

pub fn file_line_col_range( context: &'c Context, filename: &str, start_line: usize, start_col: usize, end_line: usize, end_col: usize, ) -> Self

Creates a file/line/column range location.

Source

pub fn unknown(context: &'c Context) -> Self

Creates an unknown location.

Source

pub fn context(&self) -> ContextRef<'c>

Returns a context.

Source

pub fn is_call_site(&self) -> bool

Returns true if this location is a call site location.

Source

pub fn is_file_line_col_range(&self) -> bool

Returns true if this location is a file/line/column range location.

Source

pub fn is_fused(&self) -> bool

Returns true if this location is a fused location.

Source

pub fn is_name(&self) -> bool

Returns true if this location is a name location.

Source

pub fn call_site_callee(&self) -> Self

Returns the callee of a call site location.

Source

pub fn call_site_caller(&self) -> Self

Returns the caller of a call site location.

Source

pub fn file_line_col_range_filename(&self) -> Identifier<'c>

Returns the filename of a file/line/column range location.

Source

pub fn file_line_col_range_start_line(&self) -> usize

Returns the start line of a file/line/column range location.

Source

pub fn file_line_col_range_start_column(&self) -> usize

Returns the start column of a file/line/column range location.

Source

pub fn file_line_col_range_end_line(&self) -> usize

Returns the end line of a file/line/column range location.

Source

pub fn file_line_col_range_end_column(&self) -> usize

Returns the end column of a file/line/column range location.

Source

pub fn fused_num_locations(&self) -> usize

Returns the number of locations in a fused location.

Source

pub fn fused_location(&self, index: usize) -> Self

Returns the location at index in a fused location.

Source

pub fn fused_metadata(&self) -> Attribute<'c>

Returns the metadata attribute of a fused location.

Source

pub fn name_value(&self) -> Identifier<'c>

Returns the name identifier of a name location.

Source

pub fn name_child_location(&self) -> Self

Returns the child location of a name location.

Source

pub fn to_attribute(&self) -> Attribute<'c>

Converts this location to an attribute.

Source

pub fn from_attribute(attribute: Attribute<'c>) -> Self

Creates a location from an attribute.

Source

pub unsafe fn from_raw(raw: MlirLocation) -> Self

Creates a location from a raw object.

§Safety

A raw object must be valid.

Source

pub const fn to_raw(self) -> MlirLocation

Converts a location into a raw object.

Trait Implementations§

Source§

impl<'c> Clone for Location<'c>

Source§

fn clone(&self) -> Location<'c>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'c> Debug for Location<'c>

Source§

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

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

impl Display for Location<'_>

Source§

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

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

impl PartialEq for Location<'_>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<'c> Copy for Location<'c>

Auto Trait Implementations§

§

impl<'c> Freeze for Location<'c>

§

impl<'c> RefUnwindSafe for Location<'c>

§

impl<'c> !Send for Location<'c>

§

impl<'c> !Sync for Location<'c>

§

impl<'c> Unpin for Location<'c>

§

impl<'c> UnwindSafe for Location<'c>

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.