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
36
37
38
39
40
41
42
43
44
45
46
use winapi::um::wincon::{CONSOLE_SCREEN_BUFFER_INFO, SMALL_RECT};
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
pub struct WindowPositions {
pub left: i16,
pub right: i16,
pub bottom: i16,
pub top: i16,
}
impl From<CONSOLE_SCREEN_BUFFER_INFO> for WindowPositions {
fn from(csbi: CONSOLE_SCREEN_BUFFER_INFO) -> Self {
csbi.srWindow.into()
}
}
impl From<WindowPositions> for SMALL_RECT {
fn from(positions: WindowPositions) -> Self {
SMALL_RECT {
Top: positions.top,
Right: positions.right,
Bottom: positions.bottom,
Left: positions.left,
}
}
}
impl From<SMALL_RECT> for WindowPositions {
fn from(rect: SMALL_RECT) -> Self {
WindowPositions {
left: rect.Left,
right: rect.Right,
bottom: rect.Bottom,
top: rect.Top,
}
}
}