From 9bc5cbba06d7914ac8310f1ad5d71966b2192ddd Mon Sep 17 00:00:00 2001 From: seyon Date: Fri, 23 Jun 2023 12:27:11 +0100 Subject: [PATCH] `new` for OpaqueOp --- src/ops/custom.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ops/custom.rs b/src/ops/custom.rs index 28ff420cda..a458cd9cb0 100644 --- a/src/ops/custom.rs +++ b/src/ops/custom.rs @@ -24,6 +24,14 @@ pub struct OpaqueOp { } impl OpaqueOp { + /// Initialize a new named OpaqueOp + pub fn new(id: impl Into, custom: Box) -> Self { + Self { + id: id.into(), + custom, + } + } + /// The name of the operation, cached for fast equality checks. pub fn name(&self) -> SmolStr { self.id.clone()