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