Skip to main content

Operation

Struct Operation 

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

An operation.

Implementations§

Source§

impl<'c> Operation<'c>

Source

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

Returns a context.

Source

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

Returns a name.

Source

pub fn block(&self) -> Option<BlockRef<'c, '_>>

Returns a block.

Source

pub fn operand_count(&self) -> usize

Returns the number of operands.

Source

pub fn operand(&self, index: usize) -> Result<Value<'c, '_>, Error>

Returns the operand at a position.

Source

pub fn operands(&self) -> impl Iterator<Item = Value<'c, '_>>

Returns all operands.

Source

pub fn result_count(&self) -> usize

Returns the number of results.

Source

pub fn result(&self, index: usize) -> Result<OperationResult<'c, '_>, Error>

Returns a result at a position.

Source

pub fn results(&self) -> impl Iterator<Item = OperationResult<'c, '_>>

Returns all results.

Source

pub fn region_count(&self) -> usize

Returns the number of regions.

Source

pub fn region(&self, index: usize) -> Result<RegionRef<'c, '_>, Error>

Returns a region at a position.

Source

pub fn regions(&self) -> impl Iterator<Item = RegionRef<'c, '_>>

Returns all regions.

Source

pub fn location(&self) -> Location<'c>

Gets the location of the operation.

Source

pub fn successor_count(&self) -> usize

Returns the number of successors.

Source

pub fn successor(&self, index: usize) -> Result<BlockRef<'c, '_>, Error>

Returns a successor at a position.

Source

pub fn successors(&self) -> impl Iterator<Item = BlockRef<'c, '_>>

Returns all successors.

Source

pub fn attribute_count(&self) -> usize

Returns the number of attributes.

Source

pub fn attribute_at( &self, index: usize, ) -> Result<(Identifier<'c>, Attribute<'c>), Error>

Returns a attribute at a position.

Source

pub fn attributes( &self, ) -> impl Iterator<Item = (Identifier<'c>, Attribute<'c>)> + '_

Returns all attributes.

Source

pub fn attribute(&self, name: &str) -> Result<Attribute<'c>, Error>

Returns a attribute with the given name.

Source

pub fn has_attribute(&self, name: &str) -> bool

Checks if the operation has a attribute with the given name.

Source

pub fn set_attribute(&mut self, name: &str, attribute: Attribute<'c>)

Sets the attribute with the given name to the given attribute.

Source

pub fn remove_attribute(&mut self, name: &str) -> Result<(), Error>

Removes the attribute with the given name.

Source

pub fn next_in_block(&self) -> Option<OperationRef<'c, '_>>

Returns a reference to the next operation in the same block.

Source

pub fn next_in_block_mut(&self) -> Option<OperationRefMut<'c, '_>>

Returns a mutable reference to the next operation in the same block.

Source

pub fn previous_in_block(&self) -> Option<OperationRef<'c, '_>>

Returns a reference to the previous operation in the same block.

Source

pub fn parent_operation(&self) -> Option<OperationRef<'c, '_>>

Returns a reference to a parent operation.

Source

pub fn remove_from_parent(&mut self)

Removes itself from a parent block.

Source

pub fn verify(&self) -> bool

Verifies an operation.

Source

pub fn dump(&self)

Dumps an operation.

Source

pub fn to_string_with_flags( &self, flags: OperationPrintingFlags, ) -> Result<String, Error>

Prints an operation with flags.

Source

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

Creates an operation from a raw object.

§Safety

A raw object must be valid.

Source

pub unsafe fn from_option_raw(raw: MlirOperation) -> Option<Self>

Creates an optional operation from a raw object.

§Safety

A raw object must be valid.

Source

pub const fn into_raw(self) -> MlirOperation

Converts an operation into a raw object.

Trait Implementations§

Source§

impl Clone for Operation<'_>

Source§

fn clone(&self) -> Self

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 Debug for Operation<'_>

Source§

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

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

impl Display for Operation<'_>

Source§

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

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

impl Drop for Operation<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Operation<'_>

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 Eq for Operation<'_>

Auto Trait Implementations§

§

impl<'c> Freeze for Operation<'c>

§

impl<'c> RefUnwindSafe for Operation<'c>

§

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

§

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

§

impl<'c> Unpin for Operation<'c>

§

impl<'c> UnsafeUnpin for Operation<'c>

§

impl<'c> UnwindSafe for Operation<'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.