umya_spreadsheet/structs/drawing/
preset_line_dash_values.rs1use super::super::super::EnumTrait;
2use std::str::FromStr;
3#[derive(Clone, Debug)]
4pub enum PresetLineDashValues {
5 Dash,
6 DashDot,
7 Dot,
8 LargeDash,
9 LargeDashDot,
10 LargeDashDotDot,
11 Solid,
12 SystemDash,
13 SystemDashDot,
14 SystemDashDotDot,
15 SystemDot,
16}
17impl Default for PresetLineDashValues {
18 #[inline]
19 fn default() -> Self {
20 Self::Solid
21 }
22}
23impl EnumTrait for PresetLineDashValues {
24 #[inline]
25 fn get_value_string(&self) -> &str {
26 match &self {
27 Self::Dash => "dash",
28 Self::DashDot => "dashDot",
29 Self::Dot => "dot",
30 Self::LargeDash => "lgDash",
31 Self::LargeDashDot => "lgDashDot",
32 Self::LargeDashDotDot => "lgDashDotDot",
33 Self::Solid => "solid",
34 Self::SystemDash => "sysDash",
35 Self::SystemDashDot => "sysDashDot",
36 Self::SystemDashDotDot => "sysDashDotDot",
37 Self::SystemDot => "sysDot",
38 }
39 }
40}
41impl FromStr for PresetLineDashValues {
42 type Err = ();
43
44 #[inline]
45 fn from_str(input: &str) -> Result<Self, Self::Err> {
46 match input {
47 "dash" => Ok(Self::Dash),
48 "dashDot" => Ok(Self::DashDot),
49 "dot" => Ok(Self::Dot),
50 "lgDash" => Ok(Self::LargeDash),
51 "lgDashDot" => Ok(Self::LargeDashDot),
52 "lgDashDotDot" => Ok(Self::LargeDashDotDot),
53 "solid" => Ok(Self::Solid),
54 "sysDash" => Ok(Self::SystemDash),
55 "sysDashDot" => Ok(Self::SystemDashDot),
56 "sysDashDotDot" => Ok(Self::SystemDashDotDot),
57 "sysDot" => Ok(Self::SystemDot),
58 _ => Err(()),
59 }
60 }
61}