1use super::{Color, Unit};
2use elvis_core_support::EnumStyle;
3use std::cmp::Ordering;
4
5#[derive(Clone, PartialEq, Eq)]
7pub enum BoxShadow {
8 None,
10 Inherit,
12 Initial,
14 Inset,
16 Unset,
18 Unit(Unit),
20 Color(Color),
22 Customize(Vec<BoxShadow>),
24 Derive(Vec<BoxShadow>),
26}
27
28impl Default for BoxShadow {
29 fn default() -> BoxShadow {
30 BoxShadow::None
31 }
32}
33
34impl PartialOrd for BoxShadow {
35 fn partial_cmp(&self, o: &Self) -> Option<Ordering> {
36 self.to_string().partial_cmp(&o.to_string())
37 }
38}
39
40impl Ord for BoxShadow {
41 fn cmp(&self, o: &Self) -> Ordering {
42 self.to_string().cmp(&o.to_string())
43 }
44}
45
46impl ToString for BoxShadow {
47 fn to_string(&self) -> String {
48 match self {
49 BoxShadow::None => "none".to_string(),
50 BoxShadow::Inset => "inset".to_string(),
51 BoxShadow::Inherit => "inherit".to_string(),
52 BoxShadow::Initial => "initial".to_string(),
53 BoxShadow::Unset => "unset".to_string(),
54 BoxShadow::Unit(v) => v.to_string(),
55 BoxShadow::Color(v) => v.to_string(),
56 BoxShadow::Customize(v) => v
57 .iter()
58 .map(|s| s.to_string())
59 .collect::<Vec<String>>()
60 .join(" "),
61 BoxShadow::Derive(v) => v
62 .iter()
63 .map(|bs| bs.to_string())
64 .collect::<Vec<String>>()
65 .join(", "),
66 }
67 }
68}
69
70#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, EnumStyle)]
72pub enum Position {
73 Absolute,
75 Relative,
77}
78
79impl Default for Position {
80 fn default() -> Position {
81 Position::Relative
82 }
83}