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
use winapi::um::wincon::COORD;
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
pub struct Size {
pub width: i16,
pub height: i16,
}
impl Size {
pub fn new(width: i16, height: i16) -> Size {
Size { width, height }
}
}
impl From<COORD> for Size {
fn from(coord: COORD) -> Self {
Size::new(coord.X, coord.Y)
}
}
impl Into<(u16, u16)> for Size {
fn into(self) -> (u16, u16) {
(self.width as u16, self.height as u16)
}
}