pancurses_result/
point.rs1#[derive(Clone, Copy, PartialEq, Eq)]
3pub struct Point {
4 pub y: i32,
5 pub x: i32,
6}
7
8impl From<(i32, i32)> for Point {
9 fn from(v: (i32, i32)) -> Self {
10 Point { y: v.0, x: v.1 }
11 }
12}
13
14impl From<Point> for (i32, i32) {
15 fn from(p: Point) -> (i32, i32) {
16 (p.y, p.x)
17 }
18}
19
20pub struct Dimension {
22 pub rows: i32,
23 pub columns: i32,
24}
25
26impl From<(i32, i32)> for Dimension {
27 fn from(v: (i32, i32)) -> Self {
28 Dimension {
29 rows: v.0,
30 columns: v.1,
31 }
32 }
33}
34
35impl From<Dimension> for (i32, i32) {
36 fn from(p: Dimension) -> (i32, i32) {
37 (p.rows, p.columns)
38 }
39}