Skip to content

Instantly share code, notes, and snippets.

@gerred
Created January 10, 2015 06:54
Show Gist options
  • Save gerred/fc1233aea354892c5456 to your computer and use it in GitHub Desktop.
Save gerred/fc1233aea354892c5456 to your computer and use it in GitHub Desktop.
pub struct Point<T> {
pub x: T,
pub y: T
}
impl<T> Point<T> where T: Add<T, Output=T> {
pub fn offset(&self, offset: &Point<T>) -> Point<T> {
Point { x: self.x + offset.x, y: self.y + offset.y }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment