Skip to main content

umya_spreadsheet/structs/drawing/charts/
grouping_values.rs

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