From 1df99b1ff8ca6c7c5915994548ef708ce04f9245 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 21 Nov 2014 20:00:25 +0000 Subject: [PATCH] Implement `Point2D + Size2D -> Point2D`, now that we have multi-dispatch ... in addition to the existing `Point2D + Point2D -> Point2D`. --- src/point.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/point.rs b/src/point.rs index 67730a60..14340c39 100644 --- a/src/point.rs +++ b/src/point.rs @@ -46,6 +46,12 @@ impl> Add, Point2D> for Point2D { } } +impl> Add, Point2D> for Point2D { + fn add(&self, other: &Size2D) -> Point2D { + Point2D(self.x + other.width, self.y + other.height) + } +} + impl> Point2D { pub fn add_size(&self, other: &Size2D) -> Point2D { Point2D { x: self.x + other.width, y: self.y + other.height }