math.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::fmt::{ self }; #[derive(Debug)] pub struct Vector2<T = f32> { x: T, y: T, } impl<T> Vector2<T> { pub fn new(x: T, y: T) -> Vector2<T> { Vector2 { x, y, } } } impl<T: fmt::Display> fmt::Display for Vector2<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "({}, {})", self.x, self.y) } }