Skip to main content

umya_spreadsheet/structs/
vertical_alignment_values.rs

1use std::str::FromStr;
2
3use super::EnumTrait;
4#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
5pub enum VerticalAlignmentValues {
6    Bottom,
7    Center,
8    Distributed,
9    Justify,
10    Top,
11}
12impl Default for VerticalAlignmentValues {
13    #[inline]
14    fn default() -> Self {
15        Self::Bottom
16    }
17}
18impl EnumTrait for VerticalAlignmentValues {
19    #[inline]
20    fn value_string(&self) -> &str {
21        match &self {
22            Self::Bottom => "bottom",
23            Self::Center => "center",
24            Self::Distributed => "distributed",
25            Self::Justify => "justify",
26            Self::Top => "top",
27        }
28    }
29}
30impl FromStr for VerticalAlignmentValues {
31    type Err = ();
32
33    #[inline]
34    fn from_str(input: &str) -> Result<Self, Self::Err> {
35        match input {
36            "bottom" => Ok(Self::Bottom),
37            "center" => Ok(Self::Center),
38            "distributed" => Ok(Self::Distributed),
39            "justify" => Ok(Self::Justify),
40            "top" => Ok(Self::Top),
41            _ => Err(()),
42        }
43    }
44}