Struct melior::Context

source ·
pub struct Context { /* private fields */ }
Expand description

A context of IR, dialects, and passes.

Contexts own various objects, such as types, locations, and dialect instances.

Implementations§

source§

impl Context

source

pub fn new() -> Self

Creates a context.

source

pub fn registered_dialect_count(&self) -> usize

Returns a number of registered dialects.

source

pub fn loaded_dialect_count(&self) -> usize

Returns a number of loaded dialects.

source

pub fn get_or_load_dialect(&self, name: &str) -> Dialect<'_>

Returns or loads a dialect.

source

pub fn append_dialect_registry(&self, registry: &DialectRegistry)

Appends a dialect registry.

source

pub fn load_all_available_dialects(&self)

Loads all available dialects.

source

pub fn enable_multi_threading(&self, enabled: bool)

Enables multi-threading.

source

pub fn allow_unregistered_dialects(&self) -> bool

Returns true if unregistered dialects are allowed.

source

pub fn set_allow_unregistered_dialects(&self, allowed: bool)

Sets if unregistered dialects are allowed.

source

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

Returns true if a given operation is registered in a context.

source

pub const fn to_raw(&self) -> MlirContext

Converts a context into a raw object.

source

pub fn attach_diagnostic_handler<F: FnMut(Diagnostic<'_>) -> bool>( &self, handler: F, ) -> DiagnosticHandlerId

Attaches a diagnostic handler.

source

pub fn detach_diagnostic_handler(&self, id: DiagnosticHandlerId)

Detaches a diagnostic handler.

Trait Implementations§

source§

impl Debug for Context

source§

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

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

impl Default for Context

source§

fn default() -> Self

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

impl Drop for Context

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'c> PartialEq<Context> for ContextRef<'c>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<ContextRef<'a>> for Context

source§

fn eq(&self, other: &ContextRef<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Context

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Context

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.