Closed hamirmahal closed 4 months ago
Sorry, no, this would be a breaking change. I don't think Debug
is fundamental to being numeric either.
I understand. Are you also against pub trait Num
implementing std::iter::Sum
?
#[test]
fn test_sum() {
use num_traits::Num;
pub struct LengthNArrayOfTypeT<const N: usize, T: Num>([T; N]);
impl<const N: usize, T: Clone + Num> LengthNArrayOfTypeT<N, T> {
fn dot(&self, v: &LengthNArrayOfTypeT<N, T>) -> T {
self.0
.iter()
.zip(v.0.iter())
.map(|(a, b)| a.clone() * b.clone())
.sum()
}
}
}
doesn't compile, but it could if pub trait Num
implements std::iter::Sum
, if I'm not mistaken.
Any added requirements are equally breaking changes.
fixes #318.