Skip to main content

derive_op_interface_impl

Attribute Macro derive_op_interface_impl 

Source
#[derive_op_interface_impl]
Expand description

Derive implementation of an Op Interface for an Op. Note that an impl can be derived only for those interfaces that do not require any methods to be defined during the impl.

Note: It is suggested to use the pliron_op macro instead of using this macro directly. The documention here is useful though, because pliron_op’s interfaces field expands to this macro.

Usage:


#[verify_succ]
#[def_op("dialect.name")]
#[format_op]
#[derive_op_interface_impl(MyOpInterface)]
struct MyOp;

#[op_interface]
pub trait MyOpInterface {
    fn gubbi(&self) { println!("gubbi"); }
    fn verify(op: &dyn Op, ctx: &Context) -> Result<()>
    where Self: Sized,
    {
        Ok(())
    }
}