Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ impl<T:Clone + Add<T,T>> Add<Point2D<T>, Point2D<T>> for Point2D<T> {
}
}

impl<T:Clone + Add<T,T>> Add<Size2D<T>, Point2D<T>> for Point2D<T> {
fn add(&self, other: &Size2D<T>) -> Point2D<T> {
Point2D(self.x + other.width, self.y + other.height)
}
}

impl<T: Add<T, T>> Point2D<T> {
pub fn add_size(&self, other: &Size2D<T>) -> Point2D<T> {
Point2D { x: self.x + other.width, y: self.y + other.height }
Expand Down