umya_spreadsheet/structs/drawing/charts/
legend_position_values.rs1use super::super::super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug)]
4pub enum LegendPositionValues {
5 Bottom,
6 Left,
7 Right,
8 Top,
9 TopRight,
10}
11impl Default for LegendPositionValues {
12 fn default() -> Self {
13 Self::Bottom
14 }
15}
16impl EnumTrait for LegendPositionValues {
17 fn get_value_string(&self) -> &str {
18 match &self {
19 Self::Bottom => "b",
20 Self::Left => "l",
21 Self::Right => "r",
22 Self::Top => "t",
23 Self::TopRight => "tr",
24 }
25 }
26}
27impl FromStr for LegendPositionValues {
28 type Err = ();
29 fn from_str(input: &str) -> Result<Self, Self::Err> {
30 match input {
31 "b" => Ok(Self::Bottom),
32 "l" => Ok(Self::Left),
33 "r" => Ok(Self::Right),
34 "t" => Ok(Self::Top),
35 "tr" => Ok(Self::TopRight),
36 _ => Err(()),
37 }
38 }
39}