umya_spreadsheet/structs/
source_values.rs1use super::EnumTrait;
2use std::str::FromStr;
3#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
4pub enum SourceValues {
5 Consolidation,
6 External,
7 Scenario,
8 Worksheet,
9}
10impl Default for SourceValues {
11 fn default() -> Self {
12 Self::Worksheet
13 }
14}
15impl EnumTrait for SourceValues {
16 fn get_value_string(&self) -> &str {
17 match &self {
18 Self::Consolidation => "consolidation",
19 Self::External => "external",
20 Self::Scenario => "scenario",
21 Self::Worksheet => "worksheet",
22 }
23 }
24}
25impl FromStr for SourceValues {
26 type Err = ();
27 fn from_str(input: &str) -> Result<Self, Self::Err> {
28 match input {
29 "consolidation" => Ok(Self::Consolidation),
30 "external" => Ok(Self::External),
31 "scenario" => Ok(Self::Scenario),
32 "worksheet" => Ok(Self::Worksheet),
33 _ => Err(()),
34 }
35 }
36}