mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
make multiply and divide more generic
This commit is contained in:
parent
301a22d93a
commit
4f21b40cfc
|
@ -462,22 +462,22 @@ impl<T: Number> Add<Vector2D<T>> for Vector2D<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Number> Mul<T> for Vector2D<T> {
|
impl<T: Number, U: Number + Into<T>> Mul<U> for Vector2D<T> {
|
||||||
type Output = Vector2D<T>;
|
type Output = Vector2D<T>;
|
||||||
fn mul(self, rhs: T) -> Self::Output {
|
fn mul(self, rhs: U) -> Self::Output {
|
||||||
Vector2D {
|
Vector2D {
|
||||||
x: self.x * rhs,
|
x: self.x * rhs.into(),
|
||||||
y: self.y * rhs,
|
y: self.y * rhs.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Number> Div<T> for Vector2D<T> {
|
impl<T: Number, U: Number + Into<T>> Div<U> for Vector2D<T> {
|
||||||
type Output = Vector2D<T>;
|
type Output = Vector2D<T>;
|
||||||
fn div(self, rhs: T) -> Self::Output {
|
fn div(self, rhs: U) -> Self::Output {
|
||||||
Vector2D {
|
Vector2D {
|
||||||
x: self.x / rhs,
|
x: self.x / rhs.into(),
|
||||||
y: self.y / rhs,
|
y: self.y / rhs.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue