umya_spreadsheet/structs/drawing/
text_font_alignment_values.rs

1use super::super::super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug)]
4pub enum TextFontAlignmentValues {
5    Automatic,
6    Baseline,
7    Bottom,
8    Center,
9    Top,
10}
11impl Default for TextFontAlignmentValues {
12    #[inline]
13    fn default() -> Self {
14        Self::Automatic
15    }
16}
17impl EnumTrait for TextFontAlignmentValues {
18    #[inline]
19    fn get_value_string(&self) -> &str {
20        match &self {
21            Self::Automatic => "auto",
22            Self::Baseline => "base",
23            Self::Bottom => "b",
24            Self::Center => "ctr",
25            Self::Top => "t",
26        }
27    }
28}
29impl FromStr for TextFontAlignmentValues {
30    type Err = ();
31
32    #[inline]
33    fn from_str(input: &str) -> Result<Self, Self::Err> {
34        match input {
35            "auto" => Ok(Self::Automatic),
36            "base" => Ok(Self::Baseline),
37            "b" => Ok(Self::Bottom),
38            "ctr" => Ok(Self::Center),
39            "t" => Ok(Self::Top),
40            _ => Err(()),
41        }
42    }
43}