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
26
27
28
29
30
31
32
33
34
35
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Vector2<T> {
pub x: T,
pub y: T
}
impl<T> Vector2<T> {
pub fn new(x: T, y: T) -> Vector2<T> {
Vector2 {
x: x,
y: y
}
}
}
#[cfg(feature = "cgmath")]
impl<T> Into<cgmath::Vector2<T>> for Vector2<T> {
fn into(self) -> cgmath::Vector2<T> {
cgmath::Vector2 {
x: self.x,
y: self.y
}
}
}