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