Implement std::ops::Sub<Point> for Point

This commit is contained in:
Héctor Ramón Jiménez 2020-04-28 01:12:27 +02:00
parent dc97d6f33e
commit 6c2e28d20e

View file

@ -67,3 +67,11 @@ impl std::ops::Sub<Vector> for Point {
}
}
}
impl std::ops::Sub<Point> for Point {
type Output = Vector;
fn sub(self, point: Point) -> Vector {
Vector::new(self.x - point.x, self.y - point.y)
}
}