pub trait MakeExtensionOp {
// Required methods
fn op_id(&self) -> OpName;
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,
extension: Weak<Extension>,
) -> 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 op_id(&self) -> OpName
fn op_id(&self) -> OpName
The OpDef::name
of ExtensionOp
s from which Self
can be loaded.
This identifer must be unique within the extension with which the
OpDef
is registered. An ExtensionOp
instantiating this OpDef
will
report self.opdef_id()
as its ExtensionOp::unqualified_id
.
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,
extension: Weak<Extension>,
) -> RegisteredOp<Self>where
Self: Sized,
fn to_registered(
self,
extension_id: ExtensionId,
extension: Weak<Extension>,
) -> 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 BArrayUnsafeOp
impl MakeExtensionOp for ListOpInst
impl MakeExtensionOp for StaticArrayOp
impl MakeExtensionOp for PtrOp
impl MakeExtensionOp for LoadNat
impl MakeExtensionOp for Barrier
impl MakeExtensionOp for MakeTuple
impl MakeExtensionOp for Noop
impl MakeExtensionOp for UnpackTuple
impl<AK: ArrayKind> MakeExtensionOp for GenericArrayClone<AK>
impl<AK: ArrayKind> MakeExtensionOp for GenericArrayDiscard<AK>
impl<AK: ArrayKind> MakeExtensionOp for GenericArrayOp<AK>
impl<AK: ArrayKind> MakeExtensionOp for GenericArrayRepeat<AK>
impl<AK: ArrayKind> MakeExtensionOp for GenericArrayScan<AK>
impl<AK: ArrayKind, const DIR: Direction, OtherAK: ArrayKind> MakeExtensionOp for GenericArrayConvert<AK, DIR, OtherAK>
impl<T: MakeOpDef> MakeExtensionOp for T
Blanket implementation for non-polymorphic operations - OpDef
s with no type parameters.