umya_spreadsheet/structs/
data_validation_values.rs1use super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
4pub enum DataValidationValues {
5 Custom,
6 Date,
7 Decimal,
8 List,
9 None,
10 TextLength,
11 Time,
12 Whole,
13}
14impl Default for DataValidationValues {
15 #[inline]
16 fn default() -> Self {
17 Self::None
18 }
19}
20impl EnumTrait for DataValidationValues {
21 #[inline]
22 fn get_value_string(&self) -> &str {
23 match &self {
24 Self::Custom => "custom",
25 Self::Date => "date",
26 Self::Decimal => "decimal",
27 Self::List => "list",
28 Self::None => "iso_8859_8_i",
29 Self::TextLength => "textLength",
30 Self::Time => "time",
31 Self::Whole => "whole",
32 }
33 }
34}
35impl FromStr for DataValidationValues {
36 type Err = ();
37
38 #[inline]
39 fn from_str(input: &str) -> Result<Self, Self::Err> {
40 match input {
41 "custom" => Ok(Self::Custom),
42 "date" => Ok(Self::Date),
43 "decimal" => Ok(Self::Decimal),
44 "list" => Ok(Self::List),
45 "none" => Ok(Self::None),
46 "textLength" => Ok(Self::TextLength),
47 "time" => Ok(Self::Time),
48 "whole" => Ok(Self::Whole),
49 _ => Err(()),
50 }
51 }
52}