#![allow(deprecated)]
use std::fmt;
use std::str;
#[derive(
Debug,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
conjure_object::serde::Deserialize,
conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde")]
pub enum RefpropProperty {
#[serde(rename = "TEMPERATURE")]
Temperature,
#[serde(rename = "PRESSURE")]
Pressure,
#[serde(rename = "MASS_DENSITY")]
MassDensity,
#[serde(rename = "MASS_SPECIFIC_ENTHALPY")]
MassSpecificEnthalpy,
#[serde(rename = "MASS_SPECIFIC_INTERNAL_ENERGY")]
MassSpecificInternalEnergy,
#[serde(rename = "MASS_SPECIFIC_ENTROPY")]
MassSpecificEntropy,
#[serde(rename = "VISCOSITY")]
Viscosity,
#[serde(untagged)]
Unknown(Unknown),
}
impl RefpropProperty {
#[inline]
pub fn as_str(&self) -> &str {
match self {
RefpropProperty::Temperature => "TEMPERATURE",
RefpropProperty::Pressure => "PRESSURE",
RefpropProperty::MassDensity => "MASS_DENSITY",
RefpropProperty::MassSpecificEnthalpy => "MASS_SPECIFIC_ENTHALPY",
RefpropProperty::MassSpecificInternalEnergy => {
"MASS_SPECIFIC_INTERNAL_ENERGY"
}
RefpropProperty::MassSpecificEntropy => "MASS_SPECIFIC_ENTROPY",
RefpropProperty::Viscosity => "VISCOSITY",
RefpropProperty::Unknown(v) => &*v,
}
}
}
impl fmt::Display for RefpropProperty {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.as_str(), fmt)
}
}
impl conjure_object::Plain for RefpropProperty {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
conjure_object::Plain::fmt(self.as_str(), fmt)
}
}
impl str::FromStr for RefpropProperty {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_str(
v: &str,
) -> Result<RefpropProperty, conjure_object::plain::ParseEnumError> {
match v {
"TEMPERATURE" => Ok(RefpropProperty::Temperature),
"PRESSURE" => Ok(RefpropProperty::Pressure),
"MASS_DENSITY" => Ok(RefpropProperty::MassDensity),
"MASS_SPECIFIC_ENTHALPY" => Ok(RefpropProperty::MassSpecificEnthalpy),
"MASS_SPECIFIC_INTERNAL_ENERGY" => {
Ok(RefpropProperty::MassSpecificInternalEnergy)
}
"MASS_SPECIFIC_ENTROPY" => Ok(RefpropProperty::MassSpecificEntropy),
"VISCOSITY" => Ok(RefpropProperty::Viscosity),
v => v.parse().map(|v| RefpropProperty::Unknown(Unknown(v))),
}
}
}
impl conjure_object::FromPlain for RefpropProperty {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_plain(
v: &str,
) -> Result<RefpropProperty, conjure_object::plain::ParseEnumError> {
v.parse()
}
}
#[derive(
Debug,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
conjure_object::serde::Deserialize,
conjure_object::serde::Serialize,
)]
#[serde(crate = "conjure_object::serde", transparent)]
pub struct Unknown(conjure_object::private::Variant);
impl std::ops::Deref for Unknown {
type Target = str;
#[inline]
fn deref(&self) -> &str {
&self.0
}
}
impl fmt::Display for Unknown {
#[inline]
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, fmt)
}
}