Skip to main content

umya_spreadsheet/structs/drawing/spreadsheet/
edit_as_values.rs

1use std::str::FromStr;
2
3use super::super::super::EnumTrait;
4#[derive(Clone, Debug)]
5pub enum EditAsValues {
6    Absolute,
7    OneCell,
8    TwoCell,
9}
10impl Default for EditAsValues {
11    #[inline]
12    fn default() -> Self {
13        Self::TwoCell
14    }
15}
16impl EnumTrait for EditAsValues {
17    #[inline]
18    fn value_string(&self) -> &str {
19        match &self {
20            Self::Absolute => "absolute",
21            Self::OneCell => "oneCell",
22            Self::TwoCell => "twoCell",
23        }
24    }
25}
26impl FromStr for EditAsValues {
27    type Err = ();
28
29    #[inline]
30    fn from_str(input: &str) -> Result<Self, Self::Err> {
31        match input {
32            "absolute" => Ok(Self::Absolute),
33            "oneCell" => Ok(Self::OneCell),
34            "twoCell" => Ok(Self::TwoCell),
35            _ => Err(()),
36        }
37    }
38}