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