Skip to content

Commit

Permalink
optimal-compute-core: fix blanket-implementation of ComputationFn f…
Browse files Browse the repository at this point in the history
…or `Box`
  • Loading branch information
justinlovinger committed Oct 21, 2024
1 parent e4a0f51 commit 5d9fa76
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion optimal-compute-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> ComputationFn for Box<T>
where
T: ComputationFn + ?Sized,
{
fn args(&self) -> Args {
(*(*self)).args()
}
}

#[derive(Clone, Copy, Debug)]
pub struct Val<Dim, A>
where
Expand Down

0 comments on commit 5d9fa76

Please sign in to comment.