Add Neg implementation for Vector2D

This commit is contained in:
Gwilym Kuiper 2022-09-22 21:32:36 +01:00
parent d26311e76b
commit 4eaf8af72f

View file

@ -1016,6 +1016,14 @@ impl<T: Number> Vector2D<T> {
}
}
impl <T: Number + Neg<Output = T>> Neg for Vector2D<T> {
type Output = Self;
fn neg(self) -> Self::Output {
(-self.x, -self.y).into()
}
}
#[cfg(test)]
mod tests {