Skip to main content

umya_spreadsheet/structs/
underline_values.rs

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