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