Skip to main content

umya_spreadsheet/structs/drawing/
tile_flip_values.rs

1use std::str::FromStr;
2
3use super::super::super::EnumTrait;
4#[derive(Clone, Debug)]
5pub enum TileFlipValues {
6    Horizontal,
7    HorizontalAndVertical,
8    None,
9    Vertical,
10}
11impl Default for TileFlipValues {
12    #[inline]
13    fn default() -> Self {
14        Self::None
15    }
16}
17impl EnumTrait for TileFlipValues {
18    #[inline]
19    fn value_string(&self) -> &str {
20        match &self {
21            Self::Horizontal => "x",
22            Self::HorizontalAndVertical => "xy",
23            Self::None => "none",
24            Self::Vertical => "y",
25        }
26    }
27}
28impl FromStr for TileFlipValues {
29    type Err = ();
30
31    #[inline]
32    fn from_str(input: &str) -> Result<Self, Self::Err> {
33        match input {
34            "x" => Ok(Self::Horizontal),
35            "xy" => Ok(Self::HorizontalAndVertical),
36            "none" => Ok(Self::None),
37            "y" => Ok(Self::Vertical),
38            _ => Err(()),
39        }
40    }
41}