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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum FlexDirection {
Column,
Row,
}
#[derive(Debug, Clone)]
pub struct NodeData<T: Clone> {
pub min_width: Option<f32>,
pub min_height: Option<f32>,
pub max_width: Option<f32>,
pub max_height: Option<f32>,
pub width: Option<f32>,
pub height: Option<f32>,
pub flex_direction: FlexDirection,
pub data: T,
}
impl<T: Clone> NodeData<T> {
pub fn new(min_width: Option<f32>,
min_height: Option<f32>,
max_width: Option<f32>,
max_height: Option<f32>,
width: Option<f32>,
height: Option<f32>,
flex_direction: FlexDirection,
data: T)
-> Self {
Self {
min_width,
min_height,
max_width,
max_height,
width,
height,
flex_direction,
data,
}
}
pub fn empty(flex_direction: FlexDirection,
data: T)
-> Self {
Self {
min_width: None,
min_height: None,
max_width: None,
max_height: None,
width: None,
height: None,
flex_direction: flex_direction,
data: data,
}
}
}