const generic expr based fixed length array manipulation crate
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/pervasive.rs | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -1,6 +1,6 @@ [package] name = "atools" -version = "0.1.6" +version = "0.1.7" edition = "2021" description = "const generic expr based fixed length array manipulation" authors = ["bend-n <[email protected]>"] diff --git a/src/pervasive.rs b/src/pervasive.rs index afe5846..26aa907 100644 --- a/src/pervasive.rs +++ b/src/pervasive.rs @@ -11,7 +11,7 @@ pub mod scalar_and_array { impl<T: core::ops::$op<Output = T> + Copy, const N: usize> $n<T, N> for T { fn $f(self, rhs: [T; N]) -> [T; N] { - rhs.map(|x| core::ops::$op::$f(x, self)) + rhs.map(|x| core::ops::$op::$f(self, x)) } } }; @@ -118,4 +118,5 @@ pub mod prelude { fn x() { use prelude::*; assert_eq!(2.mul([5, 2].add(5)), [20, 14]); + assert_eq!(5.0.sub([2., 6.]), [3., -1.]); } |