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 internal;

#[repr(u32)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde_support", serde(rename_all = "kebab-case"))]
pub enum Align {
	Auto = 0,
	FlexStart = 1,
	Center = 2,
	FlexEnd = 3,
	Stretch = 4,
	Baseline = 5,
	SpaceBetween = 6,
	SpaceAround = 7,
}

impl From<Align> for internal::YGAlign {
	fn from(a: Align) -> internal::YGAlign {
		match a {
			Align::Auto => internal::YGAlign::YGAlignAuto,
			Align::FlexStart => internal::YGAlign::YGAlignFlexStart,
			Align::Center => internal::YGAlign::YGAlignCenter,
			Align::FlexEnd => internal::YGAlign::YGAlignFlexEnd,
			Align::Stretch => internal::YGAlign::YGAlignStretch,
			Align::Baseline => internal::YGAlign::YGAlignBaseline,
			Align::SpaceBetween => internal::YGAlign::YGAlignSpaceBetween,
			Align::SpaceAround => internal::YGAlign::YGAlignSpaceAround,
		}
	}
}

impl From<internal::YGAlign> for Align {
	fn from(a: internal::YGAlign) -> Align {
		match a {
			internal::YGAlign::YGAlignAuto => Align::Auto,
			internal::YGAlign::YGAlignFlexStart => Align::FlexStart,
			internal::YGAlign::YGAlignCenter => Align::Center,
			internal::YGAlign::YGAlignFlexEnd => Align::FlexEnd,
			internal::YGAlign::YGAlignStretch => Align::Stretch,
			internal::YGAlign::YGAlignBaseline => Align::Baseline,
			internal::YGAlign::YGAlignSpaceBetween => Align::SpaceBetween,
			internal::YGAlign::YGAlignSpaceAround => Align::SpaceAround,
		}
	}
}