Trait orzir_core::Op
source · pub trait Op: Downcast + Print + Verify + DataFlow + ControlFlow + RegionInterface {
// Required methods
fn mnemonic(&self) -> Mnemonic;
fn mnemonic_static() -> Mnemonic
where Self: Sized;
fn register(ctx: &mut Context, parse_fn: OpParseFn)
where Self: Sized;
fn metadata(&self) -> &OpMetadata;
fn metadata_mut(&mut self) -> &mut OpMetadata;
// Provided methods
fn self_ptr(&self) -> ArenaPtr<OpObj> { ... }
fn parent_block(&self) -> Option<ArenaPtr<Block>> { ... }
fn set_parent_block(
&mut self,
parent_block: Option<ArenaPtr<Block>>
) -> Option<ArenaPtr<Block>> { ... }
fn parent_region(&self, ctx: &Context) -> Option<ArenaPtr<Region>> { ... }
}Expand description
The trait of all operations.
Required Methods§
sourcefn mnemonic_static() -> Mnemonicwhere
Self: Sized,
fn mnemonic_static() -> Mnemonicwhere
Self: Sized,
Get the mnemonic of the type statically.
sourcefn register(ctx: &mut Context, parse_fn: OpParseFn)where
Self: Sized,
fn register(ctx: &mut Context, parse_fn: OpParseFn)where
Self: Sized,
Register the operation to the context.
The Parse trait is not object-safe, so
here just pass the parse function.
fn metadata(&self) -> &OpMetadata
fn metadata_mut(&mut self) -> &mut OpMetadata
Provided Methods§
sourcefn parent_block(&self) -> Option<ArenaPtr<Block>>
fn parent_block(&self) -> Option<ArenaPtr<Block>>
Get the parent block of the operation.
Implementations§
source§impl dyn Op
impl dyn Op
sourcepub fn is<__T: Op>(&self) -> bool
pub fn is<__T: Op>(&self) -> bool
Returns true if the trait object wraps an object of type __T.
sourcepub fn downcast<__T: Op>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: Op>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T. Returns the original boxed trait if it isn’t.
sourcepub fn downcast_rc<__T: Op>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: Op>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of
type __T. Returns the original Rc-ed trait if it isn’t.
sourcepub fn downcast_ref<__T: Op>(&self) -> Option<&__T>
pub fn downcast_ref<__T: Op>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T, or
None if it isn’t.
sourcepub fn downcast_mut<__T: Op>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: Op>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T, or None if it isn’t.