#![allow(dead_code, deprecated, unused_variables, unused_mut)] use std::ops::Add; #[derive(Debug, Copy, Clone, PartialEq)] struct Point { x: T, y: T, } impl> Add for Point { type Output = Self; fn add(self, other: Self) -> Self::Output { Self { x: self.x + other.x, y: self.y + other.y, } } } fn main() { assert_eq!(Point { x : 1, y : 0 } + Point { x : 2, y : 3 }, Point { x : 3, y : 3 }); }