Skip to content

Commit

Permalink
feat: Into<OpType> for custom ops (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Dec 1, 2023
1 parent 39599d8 commit a69246b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ops/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ impl From<ExternalOp> for LeafOp {
}
}

impl From<ExternalOp> for OpType {
fn from(value: ExternalOp) -> Self {
let leaf: LeafOp = value.into();
leaf.into()
}
}

impl ExternalOp {
/// Name of the ExternalOp
pub fn name(&self) -> SmolStr {
Expand Down Expand Up @@ -235,6 +242,19 @@ impl OpaqueOp {
}
}

impl From<OpaqueOp> for LeafOp {
fn from(value: OpaqueOp) -> Self {
LeafOp::CustomOp(Box::new(ExternalOp::Opaque(value)))
}
}

impl From<OpaqueOp> for OpType {
fn from(value: OpaqueOp) -> Self {
let leaf: LeafOp = value.into();
leaf.into()
}
}

/// Resolve serialized names of operations into concrete implementation (OpDefs) where possible
#[allow(dead_code)]
pub fn resolve_extension_ops(
Expand Down

0 comments on commit a69246b

Please sign in to comment.