1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use core::ops::Rem;
use super::Vector;
impl<T: Rem<Output = T>, const N: usize> Rem for Vector<T, { N }> {
type Output = Vector<T, { N }>;
default fn rem(mut self, rhs: Self) -> Self::Output {
self.0
.iter_mut()
.zip(rhs.0.iter())
.for_each(|(v, r)| *v = unsafe { core::ptr::read(v).rem(core::ptr::read(r)) });
self
}
}
impl<T: Rem<T, Output = T> + Clone, const N: usize> Rem<T> for Vector<T, { N }> {
type Output = Vector<T, { N }>;
fn rem(mut self, rhs: T) -> Self::Output {
self.0
.iter_mut()
.for_each(|v| *v = unsafe { core::ptr::read(v).rem(rhs.clone()) });
self
}
}