mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
Merge pull request #68 from gwilymk/div-assign-for-vector2d
Implement divassign for vector 2d
This commit is contained in:
commit
04e616a1bf
|
@ -491,6 +491,14 @@ impl<T: Number, U: Number + Into<T>> Div<U> for Vector2D<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Number, U: Number + Into<T>> DivAssign<U> for Vector2D<T> {
|
||||||
|
fn div_assign(&mut self, rhs: U) {
|
||||||
|
let result = *self / rhs;
|
||||||
|
self.x = result.x;
|
||||||
|
self.y = result.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn test_vector_multiplication_and_division(_gba: &mut super::Gba) {
|
fn test_vector_multiplication_and_division(_gba: &mut super::Gba) {
|
||||||
let a: Vector2D<i32> = (1, 2).into();
|
let a: Vector2D<i32> = (1, 2).into();
|
||||||
|
|
Loading…
Reference in a new issue