use conjure_object::serde::{ser, de};
use conjure_object::serde::ser::SerializeMap as SerializeMap_;
use conjure_object::private::{UnionField_, UnionTypeField_};
use std::fmt;
#[derive(Debug, Clone, conjure_object::private::DeriveWith)]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum NumericSeries {
Abs(super::Abs),
Negate(super::Negate),
Cos(super::Cos),
Sin(super::Sin),
Tan(super::Tan),
Acos(super::Acos),
Asin(super::Asin),
Ln(super::Ln),
Log10(super::Log10),
Sqrt(super::Sqrt),
Add(super::Add),
Subtract(super::Subtract),
Multiply(super::Multiply),
Divide(super::Divide),
FloorDivide(super::FloorDivide),
Power(super::Power),
Modulo(super::Modulo),
Atan2(super::Atan2),
Max(super::MaxSeries),
Mean(super::MeanSeries),
Min(super::MinSeries),
Sum(super::SumSeries),
Union(super::NumericUnionSeries),
Product(super::ProductSeries),
Constant(Box<super::ConstantNumericSeries>),
SelectNewestPoints(super::SelectNewestPointsSeries),
SelectNumeric(super::SelectSeries),
SelectOldestPoints(super::SelectOldestPointsSeries),
BitAnd(super::BitAnd),
BitOr(super::BitOr),
BitXor(super::BitXor),
BitShiftRight(super::BitShiftRight),
BitShiftLeft(super::BitShiftLeft),
BitTest(super::BitTest),
NumericAggregation(super::NumericAggregation),
CountDuplicate(super::EnumCountDuplicateSeries),
CumulativeSum(super::CumulativeSumSeries),
Derivative(super::DerivativeSeries),
Integral(super::IntegralSeries),
ZScore(super::ZscoreSeries),
Raw(super::Reference),
Derived(Box<super::DerivedSeries>),
Resample(super::NumericResampleSeries),
SignalFilter(super::SignalFilterSeries),
TimeDifference(super::TimeDifferenceSeries),
AbsoluteTimestamp(super::AbsoluteTimestampSeries),
TimeRangeFilter(super::NumericTimeRangeFilterSeries),
TimeShift(super::NumericTimeShiftSeries),
UnitConversion(super::UnitConversionSeries),
ValueDifference(super::ValueDifferenceSeries),
FilterTransformation(super::NumericFilterTransformationSeries),
ThresholdFilter(super::NumericThresholdFilterSeries),
ApproximateFilter(super::NumericApproximateFilterSeries),
DropNan(super::NumericNanFilter),
Select1dArrayIndex(super::SelectIndexFrom1dNumericArraySeries),
AggregateUnderRanges(super::AggregateUnderRangesSeries),
FilterByExpression(super::FilterByExpressionSeries),
ScalarUdf(super::ScalarUdfSeries),
EnumToNumeric(super::EnumToNumericSeries),
Refprop(super::RefpropSeries),
ExtractFromStruct(super::ExtractNumericFromStructSeries),
TagByIntervals(super::TagByIntervalsSeries),
FilterByTag(super::NumericTagFilterSeries),
SelectTags(super::NumericSelectTagsSeries),
ToStartOfInterval(super::NumericToStartOfIntervalSeries),
#[deprecated(
note = "AggregateNumericSeries is deprecated. Use `numericAggregation` with `aggregation.GroupByAggregationBuilder` instead.\n"
)]
Aggregate(super::AggregateNumericSeries),
#[deprecated(
note = "RollingOperationSeries is deprecated. Use `numericAggregation` with `aggregation.RollingTimeAggregationBuilder` instead.\n"
)]
RollingOperation(super::RollingOperationSeries),
#[deprecated(
note = "BitOperationSeries is deprecated in favor of individual nodes for each operation."
)]
BitOperation(super::BitOperationSeries),
#[deprecated(note = "Deprecated in favor of the SelectSeries node")]
Channel(Box<super::ChannelSeries>),
#[deprecated(note = "OffsetSeries is deprecated in favor of add with a constant.")]
Offset(super::OffsetSeries),
#[deprecated(
note = "ScaleSeries is deprecated in favor of multiply with a constant."
)]
Scale(super::ScaleSeries),
#[deprecated(
note = "ArithmeticSeries is deprecated in favor of individual nodes for each operation."
)]
Arithmetic(super::ArithmeticSeries),
#[deprecated(
note = "UnaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
)]
UnaryArithmetic(super::UnaryArithmeticSeries),
#[deprecated(
note = "BinaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
)]
BinaryArithmetic(super::BinaryArithmeticSeries),
Unknown(Unknown),
}
impl ser::Serialize for NumericSeries {
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
S: ser::Serializer,
{
let mut map = s.serialize_map(Some(2))?;
match self {
NumericSeries::Abs(value) => {
map.serialize_entry(&"type", &"abs")?;
map.serialize_entry(&"abs", value)?;
}
NumericSeries::Negate(value) => {
map.serialize_entry(&"type", &"negate")?;
map.serialize_entry(&"negate", value)?;
}
NumericSeries::Cos(value) => {
map.serialize_entry(&"type", &"cos")?;
map.serialize_entry(&"cos", value)?;
}
NumericSeries::Sin(value) => {
map.serialize_entry(&"type", &"sin")?;
map.serialize_entry(&"sin", value)?;
}
NumericSeries::Tan(value) => {
map.serialize_entry(&"type", &"tan")?;
map.serialize_entry(&"tan", value)?;
}
NumericSeries::Acos(value) => {
map.serialize_entry(&"type", &"acos")?;
map.serialize_entry(&"acos", value)?;
}
NumericSeries::Asin(value) => {
map.serialize_entry(&"type", &"asin")?;
map.serialize_entry(&"asin", value)?;
}
NumericSeries::Ln(value) => {
map.serialize_entry(&"type", &"ln")?;
map.serialize_entry(&"ln", value)?;
}
NumericSeries::Log10(value) => {
map.serialize_entry(&"type", &"log10")?;
map.serialize_entry(&"log10", value)?;
}
NumericSeries::Sqrt(value) => {
map.serialize_entry(&"type", &"sqrt")?;
map.serialize_entry(&"sqrt", value)?;
}
NumericSeries::Add(value) => {
map.serialize_entry(&"type", &"add")?;
map.serialize_entry(&"add", value)?;
}
NumericSeries::Subtract(value) => {
map.serialize_entry(&"type", &"subtract")?;
map.serialize_entry(&"subtract", value)?;
}
NumericSeries::Multiply(value) => {
map.serialize_entry(&"type", &"multiply")?;
map.serialize_entry(&"multiply", value)?;
}
NumericSeries::Divide(value) => {
map.serialize_entry(&"type", &"divide")?;
map.serialize_entry(&"divide", value)?;
}
NumericSeries::FloorDivide(value) => {
map.serialize_entry(&"type", &"floorDivide")?;
map.serialize_entry(&"floorDivide", value)?;
}
NumericSeries::Power(value) => {
map.serialize_entry(&"type", &"power")?;
map.serialize_entry(&"power", value)?;
}
NumericSeries::Modulo(value) => {
map.serialize_entry(&"type", &"modulo")?;
map.serialize_entry(&"modulo", value)?;
}
NumericSeries::Atan2(value) => {
map.serialize_entry(&"type", &"atan2")?;
map.serialize_entry(&"atan2", value)?;
}
NumericSeries::Max(value) => {
map.serialize_entry(&"type", &"max")?;
map.serialize_entry(&"max", value)?;
}
NumericSeries::Mean(value) => {
map.serialize_entry(&"type", &"mean")?;
map.serialize_entry(&"mean", value)?;
}
NumericSeries::Min(value) => {
map.serialize_entry(&"type", &"min")?;
map.serialize_entry(&"min", value)?;
}
NumericSeries::Sum(value) => {
map.serialize_entry(&"type", &"sum")?;
map.serialize_entry(&"sum", value)?;
}
NumericSeries::Union(value) => {
map.serialize_entry(&"type", &"union")?;
map.serialize_entry(&"union", value)?;
}
NumericSeries::Product(value) => {
map.serialize_entry(&"type", &"product")?;
map.serialize_entry(&"product", value)?;
}
NumericSeries::Constant(value) => {
map.serialize_entry(&"type", &"constant")?;
map.serialize_entry(&"constant", value)?;
}
NumericSeries::SelectNewestPoints(value) => {
map.serialize_entry(&"type", &"selectNewestPoints")?;
map.serialize_entry(&"selectNewestPoints", value)?;
}
NumericSeries::SelectNumeric(value) => {
map.serialize_entry(&"type", &"selectNumeric")?;
map.serialize_entry(&"selectNumeric", value)?;
}
NumericSeries::SelectOldestPoints(value) => {
map.serialize_entry(&"type", &"selectOldestPoints")?;
map.serialize_entry(&"selectOldestPoints", value)?;
}
NumericSeries::BitAnd(value) => {
map.serialize_entry(&"type", &"bitAnd")?;
map.serialize_entry(&"bitAnd", value)?;
}
NumericSeries::BitOr(value) => {
map.serialize_entry(&"type", &"bitOr")?;
map.serialize_entry(&"bitOr", value)?;
}
NumericSeries::BitXor(value) => {
map.serialize_entry(&"type", &"bitXor")?;
map.serialize_entry(&"bitXor", value)?;
}
NumericSeries::BitShiftRight(value) => {
map.serialize_entry(&"type", &"bitShiftRight")?;
map.serialize_entry(&"bitShiftRight", value)?;
}
NumericSeries::BitShiftLeft(value) => {
map.serialize_entry(&"type", &"bitShiftLeft")?;
map.serialize_entry(&"bitShiftLeft", value)?;
}
NumericSeries::BitTest(value) => {
map.serialize_entry(&"type", &"bitTest")?;
map.serialize_entry(&"bitTest", value)?;
}
NumericSeries::NumericAggregation(value) => {
map.serialize_entry(&"type", &"numericAggregation")?;
map.serialize_entry(&"numericAggregation", value)?;
}
NumericSeries::CountDuplicate(value) => {
map.serialize_entry(&"type", &"countDuplicate")?;
map.serialize_entry(&"countDuplicate", value)?;
}
NumericSeries::CumulativeSum(value) => {
map.serialize_entry(&"type", &"cumulativeSum")?;
map.serialize_entry(&"cumulativeSum", value)?;
}
NumericSeries::Derivative(value) => {
map.serialize_entry(&"type", &"derivative")?;
map.serialize_entry(&"derivative", value)?;
}
NumericSeries::Integral(value) => {
map.serialize_entry(&"type", &"integral")?;
map.serialize_entry(&"integral", value)?;
}
NumericSeries::ZScore(value) => {
map.serialize_entry(&"type", &"zScore")?;
map.serialize_entry(&"zScore", value)?;
}
NumericSeries::Raw(value) => {
map.serialize_entry(&"type", &"raw")?;
map.serialize_entry(&"raw", value)?;
}
NumericSeries::Derived(value) => {
map.serialize_entry(&"type", &"derived")?;
map.serialize_entry(&"derived", value)?;
}
NumericSeries::Resample(value) => {
map.serialize_entry(&"type", &"resample")?;
map.serialize_entry(&"resample", value)?;
}
NumericSeries::SignalFilter(value) => {
map.serialize_entry(&"type", &"signalFilter")?;
map.serialize_entry(&"signalFilter", value)?;
}
NumericSeries::TimeDifference(value) => {
map.serialize_entry(&"type", &"timeDifference")?;
map.serialize_entry(&"timeDifference", value)?;
}
NumericSeries::AbsoluteTimestamp(value) => {
map.serialize_entry(&"type", &"absoluteTimestamp")?;
map.serialize_entry(&"absoluteTimestamp", value)?;
}
NumericSeries::TimeRangeFilter(value) => {
map.serialize_entry(&"type", &"timeRangeFilter")?;
map.serialize_entry(&"timeRangeFilter", value)?;
}
NumericSeries::TimeShift(value) => {
map.serialize_entry(&"type", &"timeShift")?;
map.serialize_entry(&"timeShift", value)?;
}
NumericSeries::UnitConversion(value) => {
map.serialize_entry(&"type", &"unitConversion")?;
map.serialize_entry(&"unitConversion", value)?;
}
NumericSeries::ValueDifference(value) => {
map.serialize_entry(&"type", &"valueDifference")?;
map.serialize_entry(&"valueDifference", value)?;
}
NumericSeries::FilterTransformation(value) => {
map.serialize_entry(&"type", &"filterTransformation")?;
map.serialize_entry(&"filterTransformation", value)?;
}
NumericSeries::ThresholdFilter(value) => {
map.serialize_entry(&"type", &"thresholdFilter")?;
map.serialize_entry(&"thresholdFilter", value)?;
}
NumericSeries::ApproximateFilter(value) => {
map.serialize_entry(&"type", &"approximateFilter")?;
map.serialize_entry(&"approximateFilter", value)?;
}
NumericSeries::DropNan(value) => {
map.serialize_entry(&"type", &"dropNan")?;
map.serialize_entry(&"dropNan", value)?;
}
NumericSeries::Select1dArrayIndex(value) => {
map.serialize_entry(&"type", &"select1dArrayIndex")?;
map.serialize_entry(&"select1dArrayIndex", value)?;
}
NumericSeries::AggregateUnderRanges(value) => {
map.serialize_entry(&"type", &"aggregateUnderRanges")?;
map.serialize_entry(&"aggregateUnderRanges", value)?;
}
NumericSeries::FilterByExpression(value) => {
map.serialize_entry(&"type", &"filterByExpression")?;
map.serialize_entry(&"filterByExpression", value)?;
}
NumericSeries::ScalarUdf(value) => {
map.serialize_entry(&"type", &"scalarUdf")?;
map.serialize_entry(&"scalarUdf", value)?;
}
NumericSeries::EnumToNumeric(value) => {
map.serialize_entry(&"type", &"enumToNumeric")?;
map.serialize_entry(&"enumToNumeric", value)?;
}
NumericSeries::Refprop(value) => {
map.serialize_entry(&"type", &"refprop")?;
map.serialize_entry(&"refprop", value)?;
}
NumericSeries::ExtractFromStruct(value) => {
map.serialize_entry(&"type", &"extractFromStruct")?;
map.serialize_entry(&"extractFromStruct", value)?;
}
NumericSeries::TagByIntervals(value) => {
map.serialize_entry(&"type", &"tagByIntervals")?;
map.serialize_entry(&"tagByIntervals", value)?;
}
NumericSeries::FilterByTag(value) => {
map.serialize_entry(&"type", &"filterByTag")?;
map.serialize_entry(&"filterByTag", value)?;
}
NumericSeries::SelectTags(value) => {
map.serialize_entry(&"type", &"selectTags")?;
map.serialize_entry(&"selectTags", value)?;
}
NumericSeries::ToStartOfInterval(value) => {
map.serialize_entry(&"type", &"toStartOfInterval")?;
map.serialize_entry(&"toStartOfInterval", value)?;
}
#[allow(deprecated)]
NumericSeries::Aggregate(value) => {
map.serialize_entry(&"type", &"aggregate")?;
map.serialize_entry(&"aggregate", value)?;
}
#[allow(deprecated)]
NumericSeries::RollingOperation(value) => {
map.serialize_entry(&"type", &"rollingOperation")?;
map.serialize_entry(&"rollingOperation", value)?;
}
#[allow(deprecated)]
NumericSeries::BitOperation(value) => {
map.serialize_entry(&"type", &"bitOperation")?;
map.serialize_entry(&"bitOperation", value)?;
}
#[allow(deprecated)]
NumericSeries::Channel(value) => {
map.serialize_entry(&"type", &"channel")?;
map.serialize_entry(&"channel", value)?;
}
#[allow(deprecated)]
NumericSeries::Offset(value) => {
map.serialize_entry(&"type", &"offset")?;
map.serialize_entry(&"offset", value)?;
}
#[allow(deprecated)]
NumericSeries::Scale(value) => {
map.serialize_entry(&"type", &"scale")?;
map.serialize_entry(&"scale", value)?;
}
#[allow(deprecated)]
NumericSeries::Arithmetic(value) => {
map.serialize_entry(&"type", &"arithmetic")?;
map.serialize_entry(&"arithmetic", value)?;
}
#[allow(deprecated)]
NumericSeries::UnaryArithmetic(value) => {
map.serialize_entry(&"type", &"unaryArithmetic")?;
map.serialize_entry(&"unaryArithmetic", value)?;
}
#[allow(deprecated)]
NumericSeries::BinaryArithmetic(value) => {
map.serialize_entry(&"type", &"binaryArithmetic")?;
map.serialize_entry(&"binaryArithmetic", value)?;
}
NumericSeries::Unknown(value) => {
map.serialize_entry(&"type", &value.type_)?;
map.serialize_entry(&value.type_, &value.value)?;
}
}
map.end()
}
}
impl<'de> de::Deserialize<'de> for NumericSeries {
fn deserialize<D>(d: D) -> Result<NumericSeries, D::Error>
where
D: de::Deserializer<'de>,
{
d.deserialize_map(Visitor_)
}
}
struct Visitor_;
impl<'de> de::Visitor<'de> for Visitor_ {
type Value = NumericSeries;
fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write_str("union NumericSeries")
}
fn visit_map<A>(self, mut map: A) -> Result<NumericSeries, A::Error>
where
A: de::MapAccess<'de>,
{
let v = match map.next_key::<UnionField_<Variant_>>()? {
Some(UnionField_::Type) => {
let variant = map.next_value()?;
let key = map.next_key()?;
match (variant, key) {
(Variant_::Abs, Some(Variant_::Abs)) => {
let value = map.next_value()?;
NumericSeries::Abs(value)
}
(Variant_::Negate, Some(Variant_::Negate)) => {
let value = map.next_value()?;
NumericSeries::Negate(value)
}
(Variant_::Cos, Some(Variant_::Cos)) => {
let value = map.next_value()?;
NumericSeries::Cos(value)
}
(Variant_::Sin, Some(Variant_::Sin)) => {
let value = map.next_value()?;
NumericSeries::Sin(value)
}
(Variant_::Tan, Some(Variant_::Tan)) => {
let value = map.next_value()?;
NumericSeries::Tan(value)
}
(Variant_::Acos, Some(Variant_::Acos)) => {
let value = map.next_value()?;
NumericSeries::Acos(value)
}
(Variant_::Asin, Some(Variant_::Asin)) => {
let value = map.next_value()?;
NumericSeries::Asin(value)
}
(Variant_::Ln, Some(Variant_::Ln)) => {
let value = map.next_value()?;
NumericSeries::Ln(value)
}
(Variant_::Log10, Some(Variant_::Log10)) => {
let value = map.next_value()?;
NumericSeries::Log10(value)
}
(Variant_::Sqrt, Some(Variant_::Sqrt)) => {
let value = map.next_value()?;
NumericSeries::Sqrt(value)
}
(Variant_::Add, Some(Variant_::Add)) => {
let value = map.next_value()?;
NumericSeries::Add(value)
}
(Variant_::Subtract, Some(Variant_::Subtract)) => {
let value = map.next_value()?;
NumericSeries::Subtract(value)
}
(Variant_::Multiply, Some(Variant_::Multiply)) => {
let value = map.next_value()?;
NumericSeries::Multiply(value)
}
(Variant_::Divide, Some(Variant_::Divide)) => {
let value = map.next_value()?;
NumericSeries::Divide(value)
}
(Variant_::FloorDivide, Some(Variant_::FloorDivide)) => {
let value = map.next_value()?;
NumericSeries::FloorDivide(value)
}
(Variant_::Power, Some(Variant_::Power)) => {
let value = map.next_value()?;
NumericSeries::Power(value)
}
(Variant_::Modulo, Some(Variant_::Modulo)) => {
let value = map.next_value()?;
NumericSeries::Modulo(value)
}
(Variant_::Atan2, Some(Variant_::Atan2)) => {
let value = map.next_value()?;
NumericSeries::Atan2(value)
}
(Variant_::Max, Some(Variant_::Max)) => {
let value = map.next_value()?;
NumericSeries::Max(value)
}
(Variant_::Mean, Some(Variant_::Mean)) => {
let value = map.next_value()?;
NumericSeries::Mean(value)
}
(Variant_::Min, Some(Variant_::Min)) => {
let value = map.next_value()?;
NumericSeries::Min(value)
}
(Variant_::Sum, Some(Variant_::Sum)) => {
let value = map.next_value()?;
NumericSeries::Sum(value)
}
(Variant_::Union, Some(Variant_::Union)) => {
let value = map.next_value()?;
NumericSeries::Union(value)
}
(Variant_::Product, Some(Variant_::Product)) => {
let value = map.next_value()?;
NumericSeries::Product(value)
}
(Variant_::Constant, Some(Variant_::Constant)) => {
let value = map.next_value()?;
NumericSeries::Constant(value)
}
(
Variant_::SelectNewestPoints,
Some(Variant_::SelectNewestPoints),
) => {
let value = map.next_value()?;
NumericSeries::SelectNewestPoints(value)
}
(Variant_::SelectNumeric, Some(Variant_::SelectNumeric)) => {
let value = map.next_value()?;
NumericSeries::SelectNumeric(value)
}
(
Variant_::SelectOldestPoints,
Some(Variant_::SelectOldestPoints),
) => {
let value = map.next_value()?;
NumericSeries::SelectOldestPoints(value)
}
(Variant_::BitAnd, Some(Variant_::BitAnd)) => {
let value = map.next_value()?;
NumericSeries::BitAnd(value)
}
(Variant_::BitOr, Some(Variant_::BitOr)) => {
let value = map.next_value()?;
NumericSeries::BitOr(value)
}
(Variant_::BitXor, Some(Variant_::BitXor)) => {
let value = map.next_value()?;
NumericSeries::BitXor(value)
}
(Variant_::BitShiftRight, Some(Variant_::BitShiftRight)) => {
let value = map.next_value()?;
NumericSeries::BitShiftRight(value)
}
(Variant_::BitShiftLeft, Some(Variant_::BitShiftLeft)) => {
let value = map.next_value()?;
NumericSeries::BitShiftLeft(value)
}
(Variant_::BitTest, Some(Variant_::BitTest)) => {
let value = map.next_value()?;
NumericSeries::BitTest(value)
}
(
Variant_::NumericAggregation,
Some(Variant_::NumericAggregation),
) => {
let value = map.next_value()?;
NumericSeries::NumericAggregation(value)
}
(Variant_::CountDuplicate, Some(Variant_::CountDuplicate)) => {
let value = map.next_value()?;
NumericSeries::CountDuplicate(value)
}
(Variant_::CumulativeSum, Some(Variant_::CumulativeSum)) => {
let value = map.next_value()?;
NumericSeries::CumulativeSum(value)
}
(Variant_::Derivative, Some(Variant_::Derivative)) => {
let value = map.next_value()?;
NumericSeries::Derivative(value)
}
(Variant_::Integral, Some(Variant_::Integral)) => {
let value = map.next_value()?;
NumericSeries::Integral(value)
}
(Variant_::ZScore, Some(Variant_::ZScore)) => {
let value = map.next_value()?;
NumericSeries::ZScore(value)
}
(Variant_::Raw, Some(Variant_::Raw)) => {
let value = map.next_value()?;
NumericSeries::Raw(value)
}
(Variant_::Derived, Some(Variant_::Derived)) => {
let value = map.next_value()?;
NumericSeries::Derived(value)
}
(Variant_::Resample, Some(Variant_::Resample)) => {
let value = map.next_value()?;
NumericSeries::Resample(value)
}
(Variant_::SignalFilter, Some(Variant_::SignalFilter)) => {
let value = map.next_value()?;
NumericSeries::SignalFilter(value)
}
(Variant_::TimeDifference, Some(Variant_::TimeDifference)) => {
let value = map.next_value()?;
NumericSeries::TimeDifference(value)
}
(Variant_::AbsoluteTimestamp, Some(Variant_::AbsoluteTimestamp)) => {
let value = map.next_value()?;
NumericSeries::AbsoluteTimestamp(value)
}
(Variant_::TimeRangeFilter, Some(Variant_::TimeRangeFilter)) => {
let value = map.next_value()?;
NumericSeries::TimeRangeFilter(value)
}
(Variant_::TimeShift, Some(Variant_::TimeShift)) => {
let value = map.next_value()?;
NumericSeries::TimeShift(value)
}
(Variant_::UnitConversion, Some(Variant_::UnitConversion)) => {
let value = map.next_value()?;
NumericSeries::UnitConversion(value)
}
(Variant_::ValueDifference, Some(Variant_::ValueDifference)) => {
let value = map.next_value()?;
NumericSeries::ValueDifference(value)
}
(
Variant_::FilterTransformation,
Some(Variant_::FilterTransformation),
) => {
let value = map.next_value()?;
NumericSeries::FilterTransformation(value)
}
(Variant_::ThresholdFilter, Some(Variant_::ThresholdFilter)) => {
let value = map.next_value()?;
NumericSeries::ThresholdFilter(value)
}
(Variant_::ApproximateFilter, Some(Variant_::ApproximateFilter)) => {
let value = map.next_value()?;
NumericSeries::ApproximateFilter(value)
}
(Variant_::DropNan, Some(Variant_::DropNan)) => {
let value = map.next_value()?;
NumericSeries::DropNan(value)
}
(
Variant_::Select1dArrayIndex,
Some(Variant_::Select1dArrayIndex),
) => {
let value = map.next_value()?;
NumericSeries::Select1dArrayIndex(value)
}
(
Variant_::AggregateUnderRanges,
Some(Variant_::AggregateUnderRanges),
) => {
let value = map.next_value()?;
NumericSeries::AggregateUnderRanges(value)
}
(
Variant_::FilterByExpression,
Some(Variant_::FilterByExpression),
) => {
let value = map.next_value()?;
NumericSeries::FilterByExpression(value)
}
(Variant_::ScalarUdf, Some(Variant_::ScalarUdf)) => {
let value = map.next_value()?;
NumericSeries::ScalarUdf(value)
}
(Variant_::EnumToNumeric, Some(Variant_::EnumToNumeric)) => {
let value = map.next_value()?;
NumericSeries::EnumToNumeric(value)
}
(Variant_::Refprop, Some(Variant_::Refprop)) => {
let value = map.next_value()?;
NumericSeries::Refprop(value)
}
(Variant_::ExtractFromStruct, Some(Variant_::ExtractFromStruct)) => {
let value = map.next_value()?;
NumericSeries::ExtractFromStruct(value)
}
(Variant_::TagByIntervals, Some(Variant_::TagByIntervals)) => {
let value = map.next_value()?;
NumericSeries::TagByIntervals(value)
}
(Variant_::FilterByTag, Some(Variant_::FilterByTag)) => {
let value = map.next_value()?;
NumericSeries::FilterByTag(value)
}
(Variant_::SelectTags, Some(Variant_::SelectTags)) => {
let value = map.next_value()?;
NumericSeries::SelectTags(value)
}
(Variant_::ToStartOfInterval, Some(Variant_::ToStartOfInterval)) => {
let value = map.next_value()?;
NumericSeries::ToStartOfInterval(value)
}
#[allow(deprecated)]
(Variant_::Aggregate, Some(Variant_::Aggregate)) => {
let value = map.next_value()?;
NumericSeries::Aggregate(value)
}
#[allow(deprecated)]
(Variant_::RollingOperation, Some(Variant_::RollingOperation)) => {
let value = map.next_value()?;
NumericSeries::RollingOperation(value)
}
#[allow(deprecated)]
(Variant_::BitOperation, Some(Variant_::BitOperation)) => {
let value = map.next_value()?;
NumericSeries::BitOperation(value)
}
#[allow(deprecated)]
(Variant_::Channel, Some(Variant_::Channel)) => {
let value = map.next_value()?;
NumericSeries::Channel(value)
}
#[allow(deprecated)]
(Variant_::Offset, Some(Variant_::Offset)) => {
let value = map.next_value()?;
NumericSeries::Offset(value)
}
#[allow(deprecated)]
(Variant_::Scale, Some(Variant_::Scale)) => {
let value = map.next_value()?;
NumericSeries::Scale(value)
}
#[allow(deprecated)]
(Variant_::Arithmetic, Some(Variant_::Arithmetic)) => {
let value = map.next_value()?;
NumericSeries::Arithmetic(value)
}
#[allow(deprecated)]
(Variant_::UnaryArithmetic, Some(Variant_::UnaryArithmetic)) => {
let value = map.next_value()?;
NumericSeries::UnaryArithmetic(value)
}
#[allow(deprecated)]
(Variant_::BinaryArithmetic, Some(Variant_::BinaryArithmetic)) => {
let value = map.next_value()?;
NumericSeries::BinaryArithmetic(value)
}
(Variant_::Unknown(type_), Some(Variant_::Unknown(b))) => {
if type_ == b {
let value = map.next_value()?;
NumericSeries::Unknown(Unknown { type_, value })
} else {
return Err(
de::Error::invalid_value(de::Unexpected::Str(&type_), &&*b),
)
}
}
(variant, Some(key)) => {
return Err(
de::Error::invalid_value(
de::Unexpected::Str(key.as_str()),
&variant.as_str(),
),
);
}
(variant, None) => {
return Err(de::Error::missing_field(variant.as_str()));
}
}
}
Some(UnionField_::Value(variant)) => {
let value = match &variant {
Variant_::Abs => {
let value = map.next_value()?;
NumericSeries::Abs(value)
}
Variant_::Negate => {
let value = map.next_value()?;
NumericSeries::Negate(value)
}
Variant_::Cos => {
let value = map.next_value()?;
NumericSeries::Cos(value)
}
Variant_::Sin => {
let value = map.next_value()?;
NumericSeries::Sin(value)
}
Variant_::Tan => {
let value = map.next_value()?;
NumericSeries::Tan(value)
}
Variant_::Acos => {
let value = map.next_value()?;
NumericSeries::Acos(value)
}
Variant_::Asin => {
let value = map.next_value()?;
NumericSeries::Asin(value)
}
Variant_::Ln => {
let value = map.next_value()?;
NumericSeries::Ln(value)
}
Variant_::Log10 => {
let value = map.next_value()?;
NumericSeries::Log10(value)
}
Variant_::Sqrt => {
let value = map.next_value()?;
NumericSeries::Sqrt(value)
}
Variant_::Add => {
let value = map.next_value()?;
NumericSeries::Add(value)
}
Variant_::Subtract => {
let value = map.next_value()?;
NumericSeries::Subtract(value)
}
Variant_::Multiply => {
let value = map.next_value()?;
NumericSeries::Multiply(value)
}
Variant_::Divide => {
let value = map.next_value()?;
NumericSeries::Divide(value)
}
Variant_::FloorDivide => {
let value = map.next_value()?;
NumericSeries::FloorDivide(value)
}
Variant_::Power => {
let value = map.next_value()?;
NumericSeries::Power(value)
}
Variant_::Modulo => {
let value = map.next_value()?;
NumericSeries::Modulo(value)
}
Variant_::Atan2 => {
let value = map.next_value()?;
NumericSeries::Atan2(value)
}
Variant_::Max => {
let value = map.next_value()?;
NumericSeries::Max(value)
}
Variant_::Mean => {
let value = map.next_value()?;
NumericSeries::Mean(value)
}
Variant_::Min => {
let value = map.next_value()?;
NumericSeries::Min(value)
}
Variant_::Sum => {
let value = map.next_value()?;
NumericSeries::Sum(value)
}
Variant_::Union => {
let value = map.next_value()?;
NumericSeries::Union(value)
}
Variant_::Product => {
let value = map.next_value()?;
NumericSeries::Product(value)
}
Variant_::Constant => {
let value = map.next_value()?;
NumericSeries::Constant(value)
}
Variant_::SelectNewestPoints => {
let value = map.next_value()?;
NumericSeries::SelectNewestPoints(value)
}
Variant_::SelectNumeric => {
let value = map.next_value()?;
NumericSeries::SelectNumeric(value)
}
Variant_::SelectOldestPoints => {
let value = map.next_value()?;
NumericSeries::SelectOldestPoints(value)
}
Variant_::BitAnd => {
let value = map.next_value()?;
NumericSeries::BitAnd(value)
}
Variant_::BitOr => {
let value = map.next_value()?;
NumericSeries::BitOr(value)
}
Variant_::BitXor => {
let value = map.next_value()?;
NumericSeries::BitXor(value)
}
Variant_::BitShiftRight => {
let value = map.next_value()?;
NumericSeries::BitShiftRight(value)
}
Variant_::BitShiftLeft => {
let value = map.next_value()?;
NumericSeries::BitShiftLeft(value)
}
Variant_::BitTest => {
let value = map.next_value()?;
NumericSeries::BitTest(value)
}
Variant_::NumericAggregation => {
let value = map.next_value()?;
NumericSeries::NumericAggregation(value)
}
Variant_::CountDuplicate => {
let value = map.next_value()?;
NumericSeries::CountDuplicate(value)
}
Variant_::CumulativeSum => {
let value = map.next_value()?;
NumericSeries::CumulativeSum(value)
}
Variant_::Derivative => {
let value = map.next_value()?;
NumericSeries::Derivative(value)
}
Variant_::Integral => {
let value = map.next_value()?;
NumericSeries::Integral(value)
}
Variant_::ZScore => {
let value = map.next_value()?;
NumericSeries::ZScore(value)
}
Variant_::Raw => {
let value = map.next_value()?;
NumericSeries::Raw(value)
}
Variant_::Derived => {
let value = map.next_value()?;
NumericSeries::Derived(value)
}
Variant_::Resample => {
let value = map.next_value()?;
NumericSeries::Resample(value)
}
Variant_::SignalFilter => {
let value = map.next_value()?;
NumericSeries::SignalFilter(value)
}
Variant_::TimeDifference => {
let value = map.next_value()?;
NumericSeries::TimeDifference(value)
}
Variant_::AbsoluteTimestamp => {
let value = map.next_value()?;
NumericSeries::AbsoluteTimestamp(value)
}
Variant_::TimeRangeFilter => {
let value = map.next_value()?;
NumericSeries::TimeRangeFilter(value)
}
Variant_::TimeShift => {
let value = map.next_value()?;
NumericSeries::TimeShift(value)
}
Variant_::UnitConversion => {
let value = map.next_value()?;
NumericSeries::UnitConversion(value)
}
Variant_::ValueDifference => {
let value = map.next_value()?;
NumericSeries::ValueDifference(value)
}
Variant_::FilterTransformation => {
let value = map.next_value()?;
NumericSeries::FilterTransformation(value)
}
Variant_::ThresholdFilter => {
let value = map.next_value()?;
NumericSeries::ThresholdFilter(value)
}
Variant_::ApproximateFilter => {
let value = map.next_value()?;
NumericSeries::ApproximateFilter(value)
}
Variant_::DropNan => {
let value = map.next_value()?;
NumericSeries::DropNan(value)
}
Variant_::Select1dArrayIndex => {
let value = map.next_value()?;
NumericSeries::Select1dArrayIndex(value)
}
Variant_::AggregateUnderRanges => {
let value = map.next_value()?;
NumericSeries::AggregateUnderRanges(value)
}
Variant_::FilterByExpression => {
let value = map.next_value()?;
NumericSeries::FilterByExpression(value)
}
Variant_::ScalarUdf => {
let value = map.next_value()?;
NumericSeries::ScalarUdf(value)
}
Variant_::EnumToNumeric => {
let value = map.next_value()?;
NumericSeries::EnumToNumeric(value)
}
Variant_::Refprop => {
let value = map.next_value()?;
NumericSeries::Refprop(value)
}
Variant_::ExtractFromStruct => {
let value = map.next_value()?;
NumericSeries::ExtractFromStruct(value)
}
Variant_::TagByIntervals => {
let value = map.next_value()?;
NumericSeries::TagByIntervals(value)
}
Variant_::FilterByTag => {
let value = map.next_value()?;
NumericSeries::FilterByTag(value)
}
Variant_::SelectTags => {
let value = map.next_value()?;
NumericSeries::SelectTags(value)
}
Variant_::ToStartOfInterval => {
let value = map.next_value()?;
NumericSeries::ToStartOfInterval(value)
}
Variant_::Aggregate => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::Aggregate(value)
}
Variant_::RollingOperation => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::RollingOperation(value)
}
Variant_::BitOperation => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::BitOperation(value)
}
Variant_::Channel => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::Channel(value)
}
Variant_::Offset => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::Offset(value)
}
Variant_::Scale => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::Scale(value)
}
Variant_::Arithmetic => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::Arithmetic(value)
}
Variant_::UnaryArithmetic => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::UnaryArithmetic(value)
}
Variant_::BinaryArithmetic => {
let value = map.next_value()?;
#[allow(deprecated)] NumericSeries::BinaryArithmetic(value)
}
Variant_::Unknown(type_) => {
let value = map.next_value()?;
NumericSeries::Unknown(Unknown {
type_: type_.clone(),
value,
})
}
};
if map.next_key::<UnionTypeField_>()?.is_none() {
return Err(de::Error::missing_field("type"));
}
let type_variant = map.next_value::<Variant_>()?;
if variant != type_variant {
return Err(
de::Error::invalid_value(
de::Unexpected::Str(type_variant.as_str()),
&variant.as_str(),
),
);
}
value
}
None => return Err(de::Error::missing_field("type")),
};
if map.next_key::<UnionField_<Variant_>>()?.is_some() {
return Err(de::Error::invalid_length(3, &"type and value fields"));
}
Ok(v)
}
}
#[derive(PartialEq)]
enum Variant_ {
Abs,
Negate,
Cos,
Sin,
Tan,
Acos,
Asin,
Ln,
Log10,
Sqrt,
Add,
Subtract,
Multiply,
Divide,
FloorDivide,
Power,
Modulo,
Atan2,
Max,
Mean,
Min,
Sum,
Union,
Product,
Constant,
SelectNewestPoints,
SelectNumeric,
SelectOldestPoints,
BitAnd,
BitOr,
BitXor,
BitShiftRight,
BitShiftLeft,
BitTest,
NumericAggregation,
CountDuplicate,
CumulativeSum,
Derivative,
Integral,
ZScore,
Raw,
Derived,
Resample,
SignalFilter,
TimeDifference,
AbsoluteTimestamp,
TimeRangeFilter,
TimeShift,
UnitConversion,
ValueDifference,
FilterTransformation,
ThresholdFilter,
ApproximateFilter,
DropNan,
Select1dArrayIndex,
AggregateUnderRanges,
FilterByExpression,
ScalarUdf,
EnumToNumeric,
Refprop,
ExtractFromStruct,
TagByIntervals,
FilterByTag,
SelectTags,
ToStartOfInterval,
Aggregate,
RollingOperation,
BitOperation,
Channel,
Offset,
Scale,
Arithmetic,
UnaryArithmetic,
BinaryArithmetic,
Unknown(Box<str>),
}
impl Variant_ {
fn as_str(&self) -> &'static str {
match *self {
Variant_::Abs => "abs",
Variant_::Negate => "negate",
Variant_::Cos => "cos",
Variant_::Sin => "sin",
Variant_::Tan => "tan",
Variant_::Acos => "acos",
Variant_::Asin => "asin",
Variant_::Ln => "ln",
Variant_::Log10 => "log10",
Variant_::Sqrt => "sqrt",
Variant_::Add => "add",
Variant_::Subtract => "subtract",
Variant_::Multiply => "multiply",
Variant_::Divide => "divide",
Variant_::FloorDivide => "floorDivide",
Variant_::Power => "power",
Variant_::Modulo => "modulo",
Variant_::Atan2 => "atan2",
Variant_::Max => "max",
Variant_::Mean => "mean",
Variant_::Min => "min",
Variant_::Sum => "sum",
Variant_::Union => "union",
Variant_::Product => "product",
Variant_::Constant => "constant",
Variant_::SelectNewestPoints => "selectNewestPoints",
Variant_::SelectNumeric => "selectNumeric",
Variant_::SelectOldestPoints => "selectOldestPoints",
Variant_::BitAnd => "bitAnd",
Variant_::BitOr => "bitOr",
Variant_::BitXor => "bitXor",
Variant_::BitShiftRight => "bitShiftRight",
Variant_::BitShiftLeft => "bitShiftLeft",
Variant_::BitTest => "bitTest",
Variant_::NumericAggregation => "numericAggregation",
Variant_::CountDuplicate => "countDuplicate",
Variant_::CumulativeSum => "cumulativeSum",
Variant_::Derivative => "derivative",
Variant_::Integral => "integral",
Variant_::ZScore => "zScore",
Variant_::Raw => "raw",
Variant_::Derived => "derived",
Variant_::Resample => "resample",
Variant_::SignalFilter => "signalFilter",
Variant_::TimeDifference => "timeDifference",
Variant_::AbsoluteTimestamp => "absoluteTimestamp",
Variant_::TimeRangeFilter => "timeRangeFilter",
Variant_::TimeShift => "timeShift",
Variant_::UnitConversion => "unitConversion",
Variant_::ValueDifference => "valueDifference",
Variant_::FilterTransformation => "filterTransformation",
Variant_::ThresholdFilter => "thresholdFilter",
Variant_::ApproximateFilter => "approximateFilter",
Variant_::DropNan => "dropNan",
Variant_::Select1dArrayIndex => "select1dArrayIndex",
Variant_::AggregateUnderRanges => "aggregateUnderRanges",
Variant_::FilterByExpression => "filterByExpression",
Variant_::ScalarUdf => "scalarUdf",
Variant_::EnumToNumeric => "enumToNumeric",
Variant_::Refprop => "refprop",
Variant_::ExtractFromStruct => "extractFromStruct",
Variant_::TagByIntervals => "tagByIntervals",
Variant_::FilterByTag => "filterByTag",
Variant_::SelectTags => "selectTags",
Variant_::ToStartOfInterval => "toStartOfInterval",
Variant_::Aggregate => "aggregate",
Variant_::RollingOperation => "rollingOperation",
Variant_::BitOperation => "bitOperation",
Variant_::Channel => "channel",
Variant_::Offset => "offset",
Variant_::Scale => "scale",
Variant_::Arithmetic => "arithmetic",
Variant_::UnaryArithmetic => "unaryArithmetic",
Variant_::BinaryArithmetic => "binaryArithmetic",
Variant_::Unknown(_) => "unknown variant",
}
}
}
impl<'de> de::Deserialize<'de> for Variant_ {
fn deserialize<D>(d: D) -> Result<Variant_, D::Error>
where
D: de::Deserializer<'de>,
{
d.deserialize_str(VariantVisitor_)
}
}
struct VariantVisitor_;
impl<'de> de::Visitor<'de> for VariantVisitor_ {
type Value = Variant_;
fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write_str("string")
}
fn visit_str<E>(self, value: &str) -> Result<Variant_, E>
where
E: de::Error,
{
let v = match value {
"abs" => Variant_::Abs,
"negate" => Variant_::Negate,
"cos" => Variant_::Cos,
"sin" => Variant_::Sin,
"tan" => Variant_::Tan,
"acos" => Variant_::Acos,
"asin" => Variant_::Asin,
"ln" => Variant_::Ln,
"log10" => Variant_::Log10,
"sqrt" => Variant_::Sqrt,
"add" => Variant_::Add,
"subtract" => Variant_::Subtract,
"multiply" => Variant_::Multiply,
"divide" => Variant_::Divide,
"floorDivide" => Variant_::FloorDivide,
"power" => Variant_::Power,
"modulo" => Variant_::Modulo,
"atan2" => Variant_::Atan2,
"max" => Variant_::Max,
"mean" => Variant_::Mean,
"min" => Variant_::Min,
"sum" => Variant_::Sum,
"union" => Variant_::Union,
"product" => Variant_::Product,
"constant" => Variant_::Constant,
"selectNewestPoints" => Variant_::SelectNewestPoints,
"selectNumeric" => Variant_::SelectNumeric,
"selectOldestPoints" => Variant_::SelectOldestPoints,
"bitAnd" => Variant_::BitAnd,
"bitOr" => Variant_::BitOr,
"bitXor" => Variant_::BitXor,
"bitShiftRight" => Variant_::BitShiftRight,
"bitShiftLeft" => Variant_::BitShiftLeft,
"bitTest" => Variant_::BitTest,
"numericAggregation" => Variant_::NumericAggregation,
"countDuplicate" => Variant_::CountDuplicate,
"cumulativeSum" => Variant_::CumulativeSum,
"derivative" => Variant_::Derivative,
"integral" => Variant_::Integral,
"zScore" => Variant_::ZScore,
"raw" => Variant_::Raw,
"derived" => Variant_::Derived,
"resample" => Variant_::Resample,
"signalFilter" => Variant_::SignalFilter,
"timeDifference" => Variant_::TimeDifference,
"absoluteTimestamp" => Variant_::AbsoluteTimestamp,
"timeRangeFilter" => Variant_::TimeRangeFilter,
"timeShift" => Variant_::TimeShift,
"unitConversion" => Variant_::UnitConversion,
"valueDifference" => Variant_::ValueDifference,
"filterTransformation" => Variant_::FilterTransformation,
"thresholdFilter" => Variant_::ThresholdFilter,
"approximateFilter" => Variant_::ApproximateFilter,
"dropNan" => Variant_::DropNan,
"select1dArrayIndex" => Variant_::Select1dArrayIndex,
"aggregateUnderRanges" => Variant_::AggregateUnderRanges,
"filterByExpression" => Variant_::FilterByExpression,
"scalarUdf" => Variant_::ScalarUdf,
"enumToNumeric" => Variant_::EnumToNumeric,
"refprop" => Variant_::Refprop,
"extractFromStruct" => Variant_::ExtractFromStruct,
"tagByIntervals" => Variant_::TagByIntervals,
"filterByTag" => Variant_::FilterByTag,
"selectTags" => Variant_::SelectTags,
"toStartOfInterval" => Variant_::ToStartOfInterval,
"aggregate" => Variant_::Aggregate,
"rollingOperation" => Variant_::RollingOperation,
"bitOperation" => Variant_::BitOperation,
"channel" => Variant_::Channel,
"offset" => Variant_::Offset,
"scale" => Variant_::Scale,
"arithmetic" => Variant_::Arithmetic,
"unaryArithmetic" => Variant_::UnaryArithmetic,
"binaryArithmetic" => Variant_::BinaryArithmetic,
value => Variant_::Unknown(value.to_string().into_boxed_str()),
};
Ok(v)
}
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Unknown {
type_: Box<str>,
value: conjure_object::Any,
}
impl Unknown {
#[inline]
pub fn type_(&self) -> &str {
&self.type_
}
}