umya_spreadsheet/structs/
conditional_formatting_operator_values.rs

1use super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
4pub enum ConditionalFormattingOperatorValues {
5    BeginsWith,
6    Between,
7    ContainsText,
8    EndsWith,
9    Equal,
10    GreaterThan,
11    GreaterThanOrEqual,
12    LessThan,
13    LessThanOrEqual,
14    NotBetween,
15    NotContains,
16    NotEqual,
17}
18impl Default for ConditionalFormattingOperatorValues {
19    #[inline]
20    fn default() -> Self {
21        Self::LessThan
22    }
23}
24impl EnumTrait for ConditionalFormattingOperatorValues {
25    #[inline]
26    fn get_value_string(&self) -> &str {
27        match &self {
28            Self::BeginsWith => "beginsWith",
29            Self::Between => "between",
30            Self::ContainsText => "containsText",
31            Self::EndsWith => "endsWith",
32            Self::Equal => "equal",
33            Self::GreaterThan => "greaterThan",
34            Self::GreaterThanOrEqual => "greaterThanOrEqual",
35            Self::LessThan => "lessThan",
36            Self::LessThanOrEqual => "lessThanOrEqual",
37            Self::NotBetween => "notBetween",
38            Self::NotContains => "notContains",
39            Self::NotEqual => "notEqual",
40        }
41    }
42}
43impl FromStr for ConditionalFormattingOperatorValues {
44    type Err = ();
45
46    #[inline]
47    fn from_str(input: &str) -> Result<Self, Self::Err> {
48        match input {
49            "beginsWith" => Ok(Self::BeginsWith),
50            "between" => Ok(Self::Between),
51            "containsText" => Ok(Self::ContainsText),
52            "endsWith" => Ok(Self::EndsWith),
53            "equal" => Ok(Self::Equal),
54            "greaterThan" => Ok(Self::GreaterThan),
55            "greaterThanOrEqual" => Ok(Self::GreaterThanOrEqual),
56            "lessThan" => Ok(Self::LessThan),
57            "lessThanOrEqual" => Ok(Self::LessThanOrEqual),
58            "notBetween" => Ok(Self::NotBetween),
59            "notContains" => Ok(Self::NotContains),
60            "notEqual" => Ok(Self::NotEqual),
61            _ => Err(()),
62        }
63    }
64}