nominal_api_conjure/conjure/objects/scout/compute/api/
refprop_property.rs1#![allow(deprecated)]
2use std::fmt;
3use std::str;
4#[derive(
6 Debug,
7 Clone,
8 PartialEq,
9 Eq,
10 PartialOrd,
11 Ord,
12 Hash,
13 conjure_object::serde::Deserialize,
14 conjure_object::serde::Serialize,
15 conjure_object::log_safety::derive::LogSafe
16)]
17#[serde(crate = "conjure_object::serde")]
18pub enum RefpropProperty {
19 #[serde(rename = "TEMPERATURE")]
20 Temperature,
21 #[serde(rename = "PRESSURE")]
22 Pressure,
23 #[serde(rename = "MASS_DENSITY")]
24 MassDensity,
25 #[serde(rename = "MASS_SPECIFIC_ENTHALPY")]
26 MassSpecificEnthalpy,
27 #[serde(rename = "MASS_SPECIFIC_INTERNAL_ENERGY")]
28 MassSpecificInternalEnergy,
29 #[serde(rename = "MASS_SPECIFIC_ENTROPY")]
30 MassSpecificEntropy,
31 #[serde(rename = "VISCOSITY")]
32 Viscosity,
33 #[serde(untagged)]
35 Unknown(Unknown),
36}
37impl RefpropProperty {
38 #[inline]
40 pub fn as_str(&self) -> &str {
41 match self {
42 RefpropProperty::Temperature => "TEMPERATURE",
43 RefpropProperty::Pressure => "PRESSURE",
44 RefpropProperty::MassDensity => "MASS_DENSITY",
45 RefpropProperty::MassSpecificEnthalpy => "MASS_SPECIFIC_ENTHALPY",
46 RefpropProperty::MassSpecificInternalEnergy => {
47 "MASS_SPECIFIC_INTERNAL_ENERGY"
48 }
49 RefpropProperty::MassSpecificEntropy => "MASS_SPECIFIC_ENTROPY",
50 RefpropProperty::Viscosity => "VISCOSITY",
51 RefpropProperty::Unknown(v) => &*v,
52 }
53 }
54}
55impl fmt::Display for RefpropProperty {
56 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
57 fmt::Display::fmt(self.as_str(), fmt)
58 }
59}
60impl conjure_object::Plain for RefpropProperty {
61 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
62 conjure_object::Plain::fmt(self.as_str(), fmt)
63 }
64}
65impl str::FromStr for RefpropProperty {
66 type Err = conjure_object::plain::ParseEnumError;
67 #[inline]
68 fn from_str(
69 v: &str,
70 ) -> Result<RefpropProperty, conjure_object::plain::ParseEnumError> {
71 match v {
72 "TEMPERATURE" => Ok(RefpropProperty::Temperature),
73 "PRESSURE" => Ok(RefpropProperty::Pressure),
74 "MASS_DENSITY" => Ok(RefpropProperty::MassDensity),
75 "MASS_SPECIFIC_ENTHALPY" => Ok(RefpropProperty::MassSpecificEnthalpy),
76 "MASS_SPECIFIC_INTERNAL_ENERGY" => {
77 Ok(RefpropProperty::MassSpecificInternalEnergy)
78 }
79 "MASS_SPECIFIC_ENTROPY" => Ok(RefpropProperty::MassSpecificEntropy),
80 "VISCOSITY" => Ok(RefpropProperty::Viscosity),
81 v => v.parse().map(|v| RefpropProperty::Unknown(Unknown(v))),
82 }
83 }
84}
85impl conjure_object::FromPlain for RefpropProperty {
86 type Err = conjure_object::plain::ParseEnumError;
87 #[inline]
88 fn from_plain(
89 v: &str,
90 ) -> Result<RefpropProperty, conjure_object::plain::ParseEnumError> {
91 v.parse()
92 }
93}
94#[derive(
96 Debug,
97 Clone,
98 PartialEq,
99 Eq,
100 PartialOrd,
101 Ord,
102 Hash,
103 conjure_object::serde::Deserialize,
104 conjure_object::serde::Serialize,
105 conjure_object::log_safety::derive::LogSafe,
106)]
107#[serde(crate = "conjure_object::serde", transparent)]
108pub struct Unknown(conjure_object::private::Variant);
109impl std::ops::Deref for Unknown {
110 type Target = str;
111 #[inline]
112 fn deref(&self) -> &str {
113 &self.0
114 }
115}
116impl fmt::Display for Unknown {
117 #[inline]
118 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
119 fmt::Display::fmt(&self.0, fmt)
120 }
121}