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
macro_rules! impl_union_property_conversion {
    ($src:ident) => {
        impl From<$src> for PropertyValue {
            fn from(value: $src) -> PropertyValue {
                PropertyValue::$src(value)
            }
        }
    };
}

macro_rules! impl_union_into_appearance {
    ($src:ident) => {
        impl From<$src> for Appearance {
            fn from(value: $src) -> Appearance {
                Appearance::$src(value)
            }
        }

        impl From<$src> for PropertyValue {
            fn from(value: $src) -> PropertyValue {
                let appearance: Appearance = value.into();
                PropertyValue::Appearance(appearance)
            }
        }
    };
}

macro_rules! impl_union_into_layout {
    ($src:ident) => {
        impl From<$src> for Layout {
            fn from(value: $src) -> Layout {
                Layout::$src(value)
            }
        }

        impl From<$src> for PropertyValue {
            fn from(value: $src) -> PropertyValue {
                let layout: Layout = value.into();
                PropertyValue::Layout(layout)
            }
        }
    };
}

macro_rules! impl_into_for_yoga_property {
    ($src:ident, $target:ident) => {
        impl From<$src> for $target {
            fn from(source: $src) -> $target {
                $target::$src(source)
            }
        }
    };
}

macro_rules! make_initial_style_states {
    ($style:ident, [$($state:ident),*]) => {
        use types::Properties;
        $(
            $style.states.insert(stringify!($state).to_string(), Properties::default());
        )*
    };
}