1 // check-pass 2 3 use std::ops::Mul; 4 main()5fn main() {} 6 7 trait Ring {} 8 trait Real: Ring {} 9 10 trait Module: Sized + Mul<<Self as Module>::Ring, Output = Self> { 11 type Ring: Ring; 12 } 13 14 trait EuclideanSpace { 15 type Coordinates: Module<Ring = Self::Real>; 16 type Real: Real; 17 } 18 19 trait Translation<E: EuclideanSpace> { 20 fn to_vector(&self) -> E::Coordinates; 21 22 fn powf(&self, n: <E::Coordinates as Module>::Ring) -> E::Coordinates { 23 self.to_vector() * n 24 } 25 } 26