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