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