From 5d9fa7651013305bfcc73c57441fa77b0ca1d4b4 Mon Sep 17 00:00:00 2001 From: Justin Lovinger Date: Mon, 21 Oct 2024 19:53:00 +0000 Subject: [PATCH] optimal-compute-core: fix blanket-implementation of `ComputationFn` for `Box` --- optimal-compute-core/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/optimal-compute-core/src/lib.rs b/optimal-compute-core/src/lib.rs index 371b07a..44196d9 100644 --- a/optimal-compute-core/src/lib.rs +++ b/optimal-compute-core/src/lib.rs @@ -475,11 +475,21 @@ where /// /// Most computations should implement this, /// even if they represent a function with zero arguments. -#[blanket(derive(Ref, Mut, Box, Rc, Arc, Cow))] +#[blanket(derive(Ref, Mut, Rc, Arc, Cow))] pub trait ComputationFn: Computation { fn args(&self) -> Args; } +// `blanket` version `0.4.0` derives this without `?Sized`. +impl ComputationFn for Box +where + T: ComputationFn + ?Sized, +{ + fn args(&self) -> Args { + (*(*self)).args() + } +} + #[derive(Clone, Copy, Debug)] pub struct Val where