umya_spreadsheet/structs/
horizontal_alignment_values.rs

1use super::EnumTrait;
2use std::str::FromStr;
3#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
4pub enum HorizontalAlignmentValues {
5    Center,
6    CenterContinuous,
7    Distributed,
8    Fill,
9    General,
10    Justify,
11    Left,
12    Right,
13}
14impl Default for HorizontalAlignmentValues {
15    #[inline]
16    fn default() -> Self {
17        Self::General
18    }
19}
20impl EnumTrait for HorizontalAlignmentValues {
21    #[inline]
22    fn get_value_string(&self) -> &str {
23        match &self {
24            Self::Center => "center",
25            Self::CenterContinuous => "centerContinuous",
26            Self::Distributed => "distributed",
27            Self::Fill => "fill",
28            Self::General => "general",
29            Self::Justify => "justify",
30            Self::Left => "left",
31            Self::Right => "right",
32        }
33    }
34}
35impl FromStr for HorizontalAlignmentValues {
36    type Err = ();
37
38    #[inline]
39    fn from_str(input: &str) -> Result<Self, Self::Err> {
40        match input {
41            "center" => Ok(Self::Center),
42            "centerContinuous" => Ok(Self::CenterContinuous),
43            "distributed" => Ok(Self::Distributed),
44            "fill" => Ok(Self::Fill),
45            "general" => Ok(Self::General),
46            "justify" => Ok(Self::Justify),
47            "left" => Ok(Self::Left),
48            "right" => Ok(Self::Right),
49            _ => Err(()),
50        }
51    }
52}