umya_spreadsheet/structs/
conditional_format_value_object_values.rs

1use super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
4pub enum ConditionalFormatValueObjectValues {
5    Formula,
6    Max,
7    Min,
8    Number,
9    Percent,
10    Percentile,
11}
12impl Default for ConditionalFormatValueObjectValues {
13    #[inline]
14    fn default() -> Self {
15        Self::Number
16    }
17}
18impl EnumTrait for ConditionalFormatValueObjectValues {
19    #[inline]
20    fn get_value_string(&self) -> &str {
21        match &self {
22            Self::Formula => "formula",
23            Self::Max => "max",
24            Self::Min => "min",
25            Self::Number => "num",
26            Self::Percent => "percent",
27            Self::Percentile => "percentile",
28        }
29    }
30}
31impl FromStr for ConditionalFormatValueObjectValues {
32    type Err = ();
33
34    #[inline]
35    fn from_str(input: &str) -> Result<Self, Self::Err> {
36        match input {
37            "formula" => Ok(Self::Formula),
38            "max" => Ok(Self::Max),
39            "min" => Ok(Self::Min),
40            "num" => Ok(Self::Number),
41            "percent" => Ok(Self::Percent),
42            "percentile" => Ok(Self::Percentile),
43            _ => Err(()),
44        }
45    }
46}