umya_spreadsheet/structs/drawing/charts/
time_unit_values.rs

1use super::super::super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug)]
4pub enum TimeUnitValues {
5    Days,
6    Months,
7    Years,
8}
9impl Default for TimeUnitValues {
10    fn default() -> Self {
11        Self::Days
12    }
13}
14impl EnumTrait for TimeUnitValues {
15    fn get_value_string(&self) -> &str {
16        match &self {
17            Self::Days => "days",
18            Self::Months => "months",
19            Self::Years => "years",
20        }
21    }
22}
23impl FromStr for TimeUnitValues {
24    type Err = ();
25    fn from_str(input: &str) -> Result<Self, Self::Err> {
26        match input {
27            "days" => Ok(Self::Days),
28            "months" => Ok(Self::Months),
29            "years" => Ok(Self::Years),
30            _ => Err(()),
31        }
32    }
33}