nominal_api/conjure/objects/scout/chartdefinition/api/
axis_position.rs1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4#[derive(
5 Debug,
6 Clone,
7 PartialEq,
8 Eq,
9 PartialOrd,
10 Ord,
11 Hash,
12 conjure_object::serde::Deserialize,
13 conjure_object::serde::Serialize,
14)]
15#[serde(crate = "conjure_object::serde")]
16pub enum AxisPosition {
17 #[serde(rename = "LEFT")]
18 Left,
19 #[serde(rename = "RIGHT")]
20 Right,
21 #[serde(untagged)]
23 Unknown(Unknown),
24}
25impl AxisPosition {
26 #[inline]
28 pub fn as_str(&self) -> &str {
29 match self {
30 AxisPosition::Left => "LEFT",
31 AxisPosition::Right => "RIGHT",
32 AxisPosition::Unknown(v) => &*v,
33 }
34 }
35}
36impl fmt::Display for AxisPosition {
37 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
38 fmt::Display::fmt(self.as_str(), fmt)
39 }
40}
41impl conjure_object::Plain for AxisPosition {
42 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
43 conjure_object::Plain::fmt(self.as_str(), fmt)
44 }
45}
46impl str::FromStr for AxisPosition {
47 type Err = conjure_object::plain::ParseEnumError;
48 #[inline]
49 fn from_str(v: &str) -> Result<AxisPosition, conjure_object::plain::ParseEnumError> {
50 match v {
51 "LEFT" => Ok(AxisPosition::Left),
52 "RIGHT" => Ok(AxisPosition::Right),
53 v => v.parse().map(|v| AxisPosition::Unknown(Unknown(v))),
54 }
55 }
56}
57impl conjure_object::FromPlain for AxisPosition {
58 type Err = conjure_object::plain::ParseEnumError;
59 #[inline]
60 fn from_plain(
61 v: &str,
62 ) -> Result<AxisPosition, conjure_object::plain::ParseEnumError> {
63 v.parse()
64 }
65}
66#[derive(
68 Debug,
69 Clone,
70 PartialEq,
71 Eq,
72 PartialOrd,
73 Ord,
74 Hash,
75 conjure_object::serde::Deserialize,
76 conjure_object::serde::Serialize,
77)]
78#[serde(crate = "conjure_object::serde", transparent)]
79pub struct Unknown(conjure_object::private::Variant);
80impl std::ops::Deref for Unknown {
81 type Target = str;
82 #[inline]
83 fn deref(&self) -> &str {
84 &self.0
85 }
86}
87impl fmt::Display for Unknown {
88 #[inline]
89 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
90 fmt::Display::fmt(&self.0, fmt)
91 }
92}