Skip to main content

umya_spreadsheet/structs/drawing/
light_rig_direction_values.rs

1use std::str::FromStr;
2
3use super::super::super::EnumTrait;
4#[derive(Clone, Debug)]
5pub enum LightRigDirectionValues {
6    Bottom,
7    BottomLeft,
8    BottomRight,
9    Left,
10    Right,
11    Top,
12    TopLeft,
13    TopRight,
14}
15impl Default for LightRigDirectionValues {
16    #[inline]
17    fn default() -> Self {
18        Self::TopLeft
19    }
20}
21impl EnumTrait for LightRigDirectionValues {
22    #[inline]
23    fn value_string(&self) -> &str {
24        match &self {
25            Self::Bottom => "b",
26            Self::BottomLeft => "bl",
27            Self::BottomRight => "br",
28            Self::Left => "l",
29            Self::Right => "r",
30            Self::Top => "t",
31            Self::TopLeft => "tl",
32            Self::TopRight => "tr",
33        }
34    }
35}
36impl FromStr for LightRigDirectionValues {
37    type Err = ();
38
39    #[inline]
40    fn from_str(input: &str) -> Result<Self, Self::Err> {
41        match input {
42            "b" => Ok(Self::Bottom),
43            "bl" => Ok(Self::BottomLeft),
44            "br" => Ok(Self::BottomRight),
45            "l" => Ok(Self::Left),
46            "r" => Ok(Self::Right),
47            "t" => Ok(Self::Top),
48            "tl" => Ok(Self::TopLeft),
49            "tr" => Ok(Self::TopRight),
50            _ => Err(()),
51        }
52    }
53}