#![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 NumericUnionOperation {
#[serde(rename = "MIN")]
Min,
#[serde(rename = "MAX")]
Max,
#[serde(rename = "MEAN")]
Mean,
#[serde(rename = "SUM")]
Sum,
#[serde(rename = "COUNT")]
Count,
#[serde(rename = "STANDARD_DEVIATION")]
StandardDeviation,
#[serde(rename = "ROOT_MEAN_SQUARE")]
RootMeanSquare,
#[serde(rename = "THROW")]
Throw,
#[serde(untagged)]
Unknown(Unknown),
}
impl NumericUnionOperation {
#[inline]
pub fn as_str(&self) -> &str {
match self {
NumericUnionOperation::Min => "MIN",
NumericUnionOperation::Max => "MAX",
NumericUnionOperation::Mean => "MEAN",
NumericUnionOperation::Sum => "SUM",
NumericUnionOperation::Count => "COUNT",
NumericUnionOperation::StandardDeviation => "STANDARD_DEVIATION",
NumericUnionOperation::RootMeanSquare => "ROOT_MEAN_SQUARE",
NumericUnionOperation::Throw => "THROW",
NumericUnionOperation::Unknown(v) => &*v,
}
}
}
impl fmt::Display for NumericUnionOperation {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.as_str(), fmt)
}
}
impl conjure_object::Plain for NumericUnionOperation {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
conjure_object::Plain::fmt(self.as_str(), fmt)
}
}
impl str::FromStr for NumericUnionOperation {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_str(
v: &str,
) -> Result<NumericUnionOperation, conjure_object::plain::ParseEnumError> {
match v {
"MIN" => Ok(NumericUnionOperation::Min),
"MAX" => Ok(NumericUnionOperation::Max),
"MEAN" => Ok(NumericUnionOperation::Mean),
"SUM" => Ok(NumericUnionOperation::Sum),
"COUNT" => Ok(NumericUnionOperation::Count),
"STANDARD_DEVIATION" => Ok(NumericUnionOperation::StandardDeviation),
"ROOT_MEAN_SQUARE" => Ok(NumericUnionOperation::RootMeanSquare),
"THROW" => Ok(NumericUnionOperation::Throw),
v => v.parse().map(|v| NumericUnionOperation::Unknown(Unknown(v))),
}
}
}
impl conjure_object::FromPlain for NumericUnionOperation {
type Err = conjure_object::plain::ParseEnumError;
#[inline]
fn from_plain(
v: &str,
) -> Result<NumericUnionOperation, 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)
}
}