Trait hugr_core::extension::simple_op::MakeExtensionOp
source · pub trait MakeExtensionOp: NamedOp {
// Required methods
fn from_extension_op(ext_op: &ExtensionOp) -> Result<Self, OpLoadError>
where Self: Sized;
fn type_args(&self) -> Vec<TypeArg>;
// Provided methods
fn from_optype(op: &OpType) -> Option<Self>
where Self: Sized { ... }
fn to_registered(
self,
extension_id: ExtensionId,
registry: &ExtensionRegistry
) -> RegisteredOp<'_, Self>
where Self: Sized { ... }
}
Expand description
Traits implemented by types which can be loaded from ExtensionOp
s,
i.e. concrete instances of OpDef
s, with defined type arguments.
Required Methods§
sourcefn from_extension_op(ext_op: &ExtensionOp) -> Result<Self, OpLoadError>where
Self: Sized,
fn from_extension_op(ext_op: &ExtensionOp) -> Result<Self, OpLoadError>where
Self: Sized,
Try to load one of the operations of this set from an OpDef.
Provided Methods§
sourcefn from_optype(op: &OpType) -> Option<Self>where
Self: Sized,
fn from_optype(op: &OpType) -> Option<Self>where
Self: Sized,
Try to instantiate a variant from an OpType. Default behaviour assumes an ExtensionOp and loads from the name.
sourcefn to_registered(
self,
extension_id: ExtensionId,
registry: &ExtensionRegistry
) -> RegisteredOp<'_, Self>where
Self: Sized,
fn to_registered(
self,
extension_id: ExtensionId,
registry: &ExtensionRegistry
) -> RegisteredOp<'_, Self>where
Self: Sized,
Given the ID of the extension this operation is defined in, and a registry containing that extension, return a RegisteredOp.
Implementors§
impl MakeExtensionOp for ConvertOpType
impl MakeExtensionOp for ConcreteIntOp
impl MakeExtensionOp for ListOpInst
impl MakeExtensionOp for ConcreteLogicOp
impl<T: MakeOpDef> MakeExtensionOp for T
Blanket implementation for non-polymorphic operations - OpDefs with no type parameters.