Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
numeric_series.rs

1use conjure_object::serde::{ser, de};
2use conjure_object::serde::ser::SerializeMap as SerializeMap_;
3use conjure_object::private::{UnionField_, UnionTypeField_};
4use std::fmt;
5#[derive(Debug, Clone, conjure_object::private::DeriveWith)]
6#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum NumericSeries {
8    Abs(super::Abs),
9    Negate(super::Negate),
10    Cos(super::Cos),
11    Sin(super::Sin),
12    Tan(super::Tan),
13    Acos(super::Acos),
14    Asin(super::Asin),
15    Ln(super::Ln),
16    Log10(super::Log10),
17    Sqrt(super::Sqrt),
18    Add(super::Add),
19    Subtract(super::Subtract),
20    Multiply(super::Multiply),
21    Divide(super::Divide),
22    FloorDivide(super::FloorDivide),
23    Power(super::Power),
24    Modulo(super::Modulo),
25    Atan2(super::Atan2),
26    Max(super::MaxSeries),
27    Mean(super::MeanSeries),
28    Min(super::MinSeries),
29    Sum(super::SumSeries),
30    Union(super::NumericUnionSeries),
31    Product(super::ProductSeries),
32    Constant(Box<super::ConstantNumericSeries>),
33    SelectNewestPoints(super::SelectNewestPointsSeries),
34    SelectNumeric(super::SelectSeries),
35    SelectOldestPoints(super::SelectOldestPointsSeries),
36    BitAnd(super::BitAnd),
37    BitOr(super::BitOr),
38    BitXor(super::BitXor),
39    BitShiftRight(super::BitShiftRight),
40    BitShiftLeft(super::BitShiftLeft),
41    BitTest(super::BitTest),
42    IfElse(super::NumericIfElseSeries),
43    NumericAggregation(super::NumericAggregation),
44    CountDuplicate(super::EnumCountDuplicateSeries),
45    CumulativeSum(super::CumulativeSumSeries),
46    Derivative(super::DerivativeSeries),
47    Integral(super::IntegralSeries),
48    ZScore(super::ZscoreSeries),
49    Raw(super::Reference),
50    Derived(Box<super::DerivedSeries>),
51    Resample(super::NumericResampleSeries),
52    NthPointDownsample(super::NumericNthPointDownsampleSeries),
53    LargestTriangleThreeBuckets(super::NumericLargestTriangleThreeBucketsSeries),
54    SignalFilter(super::SignalFilterSeries),
55    TimeDifference(super::TimeDifferenceSeries),
56    AbsoluteTimestamp(super::AbsoluteTimestampSeries),
57    TimeRangeFilter(super::NumericTimeRangeFilterSeries),
58    TimeShift(super::NumericTimeShiftSeries),
59    TimeShiftV2(super::NumericTimeShiftSeriesV2),
60    UnitConversion(super::UnitConversionSeries),
61    ValueDifference(super::ValueDifferenceSeries),
62    FilterTransformation(super::NumericFilterTransformationSeries),
63    ThresholdFilter(super::NumericThresholdFilterSeries),
64    ApproximateFilter(super::NumericApproximateFilterSeries),
65    DropNan(super::NumericNanFilter),
66    Select1dArrayIndex(super::SelectIndexFrom1dNumericArraySeries),
67    AggregateUnderRanges(super::AggregateUnderRangesSeries),
68    FilterByExpression(super::FilterByExpressionSeries),
69    ScalarUdf(super::ScalarUdfSeries),
70    EnumToNumeric(super::EnumToNumericSeries),
71    Refprop(super::RefpropSeries),
72    ExtractFromStruct(super::ExtractNumericFromStructSeries),
73    TagByIntervals(super::TagByIntervalsSeries),
74    FilterByTag(super::NumericTagFilterSeries),
75    SelectTags(super::NumericSelectTagsSeries),
76    ToStartOfInterval(super::NumericToStartOfIntervalSeries),
77    PhaseUnwrap(super::PhaseUnwrapSeries),
78    #[deprecated(
79        note = "AggregateNumericSeries is deprecated. Use `numericAggregation` with `aggregation.GroupByAggregationBuilder` instead.\n"
80    )]
81    Aggregate(super::AggregateNumericSeries),
82    #[deprecated(
83        note = "RollingOperationSeries is deprecated. Use `numericAggregation` with `aggregation.RollingTimeAggregationBuilder` instead.\n"
84    )]
85    RollingOperation(super::RollingOperationSeries),
86    #[deprecated(
87        note = "BitOperationSeries is deprecated in favor of individual nodes for each operation."
88    )]
89    BitOperation(super::BitOperationSeries),
90    #[deprecated(note = "Deprecated in favor of the SelectSeries node")]
91    Channel(Box<super::ChannelSeries>),
92    #[deprecated(note = "OffsetSeries is deprecated in favor of add with a constant.")]
93    Offset(super::OffsetSeries),
94    #[deprecated(
95        note = "ScaleSeries is deprecated in favor of multiply with a constant."
96    )]
97    Scale(super::ScaleSeries),
98    #[deprecated(
99        note = "ArithmeticSeries is deprecated in favor of individual nodes for each operation."
100    )]
101    Arithmetic(super::ArithmeticSeries),
102    #[deprecated(
103        note = "UnaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
104    )]
105    UnaryArithmetic(super::UnaryArithmeticSeries),
106    #[deprecated(
107        note = "BinaryArithmeticSeries is deprecated in favor of individual nodes for each operation."
108    )]
109    BinaryArithmetic(super::BinaryArithmeticSeries),
110    /// An unknown variant.
111    Unknown(Unknown),
112}
113impl ser::Serialize for NumericSeries {
114    fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
115    where
116        S: ser::Serializer,
117    {
118        let mut map = s.serialize_map(Some(2))?;
119        match self {
120            NumericSeries::Abs(value) => {
121                map.serialize_entry(&"type", &"abs")?;
122                map.serialize_entry(&"abs", value)?;
123            }
124            NumericSeries::Negate(value) => {
125                map.serialize_entry(&"type", &"negate")?;
126                map.serialize_entry(&"negate", value)?;
127            }
128            NumericSeries::Cos(value) => {
129                map.serialize_entry(&"type", &"cos")?;
130                map.serialize_entry(&"cos", value)?;
131            }
132            NumericSeries::Sin(value) => {
133                map.serialize_entry(&"type", &"sin")?;
134                map.serialize_entry(&"sin", value)?;
135            }
136            NumericSeries::Tan(value) => {
137                map.serialize_entry(&"type", &"tan")?;
138                map.serialize_entry(&"tan", value)?;
139            }
140            NumericSeries::Acos(value) => {
141                map.serialize_entry(&"type", &"acos")?;
142                map.serialize_entry(&"acos", value)?;
143            }
144            NumericSeries::Asin(value) => {
145                map.serialize_entry(&"type", &"asin")?;
146                map.serialize_entry(&"asin", value)?;
147            }
148            NumericSeries::Ln(value) => {
149                map.serialize_entry(&"type", &"ln")?;
150                map.serialize_entry(&"ln", value)?;
151            }
152            NumericSeries::Log10(value) => {
153                map.serialize_entry(&"type", &"log10")?;
154                map.serialize_entry(&"log10", value)?;
155            }
156            NumericSeries::Sqrt(value) => {
157                map.serialize_entry(&"type", &"sqrt")?;
158                map.serialize_entry(&"sqrt", value)?;
159            }
160            NumericSeries::Add(value) => {
161                map.serialize_entry(&"type", &"add")?;
162                map.serialize_entry(&"add", value)?;
163            }
164            NumericSeries::Subtract(value) => {
165                map.serialize_entry(&"type", &"subtract")?;
166                map.serialize_entry(&"subtract", value)?;
167            }
168            NumericSeries::Multiply(value) => {
169                map.serialize_entry(&"type", &"multiply")?;
170                map.serialize_entry(&"multiply", value)?;
171            }
172            NumericSeries::Divide(value) => {
173                map.serialize_entry(&"type", &"divide")?;
174                map.serialize_entry(&"divide", value)?;
175            }
176            NumericSeries::FloorDivide(value) => {
177                map.serialize_entry(&"type", &"floorDivide")?;
178                map.serialize_entry(&"floorDivide", value)?;
179            }
180            NumericSeries::Power(value) => {
181                map.serialize_entry(&"type", &"power")?;
182                map.serialize_entry(&"power", value)?;
183            }
184            NumericSeries::Modulo(value) => {
185                map.serialize_entry(&"type", &"modulo")?;
186                map.serialize_entry(&"modulo", value)?;
187            }
188            NumericSeries::Atan2(value) => {
189                map.serialize_entry(&"type", &"atan2")?;
190                map.serialize_entry(&"atan2", value)?;
191            }
192            NumericSeries::Max(value) => {
193                map.serialize_entry(&"type", &"max")?;
194                map.serialize_entry(&"max", value)?;
195            }
196            NumericSeries::Mean(value) => {
197                map.serialize_entry(&"type", &"mean")?;
198                map.serialize_entry(&"mean", value)?;
199            }
200            NumericSeries::Min(value) => {
201                map.serialize_entry(&"type", &"min")?;
202                map.serialize_entry(&"min", value)?;
203            }
204            NumericSeries::Sum(value) => {
205                map.serialize_entry(&"type", &"sum")?;
206                map.serialize_entry(&"sum", value)?;
207            }
208            NumericSeries::Union(value) => {
209                map.serialize_entry(&"type", &"union")?;
210                map.serialize_entry(&"union", value)?;
211            }
212            NumericSeries::Product(value) => {
213                map.serialize_entry(&"type", &"product")?;
214                map.serialize_entry(&"product", value)?;
215            }
216            NumericSeries::Constant(value) => {
217                map.serialize_entry(&"type", &"constant")?;
218                map.serialize_entry(&"constant", value)?;
219            }
220            NumericSeries::SelectNewestPoints(value) => {
221                map.serialize_entry(&"type", &"selectNewestPoints")?;
222                map.serialize_entry(&"selectNewestPoints", value)?;
223            }
224            NumericSeries::SelectNumeric(value) => {
225                map.serialize_entry(&"type", &"selectNumeric")?;
226                map.serialize_entry(&"selectNumeric", value)?;
227            }
228            NumericSeries::SelectOldestPoints(value) => {
229                map.serialize_entry(&"type", &"selectOldestPoints")?;
230                map.serialize_entry(&"selectOldestPoints", value)?;
231            }
232            NumericSeries::BitAnd(value) => {
233                map.serialize_entry(&"type", &"bitAnd")?;
234                map.serialize_entry(&"bitAnd", value)?;
235            }
236            NumericSeries::BitOr(value) => {
237                map.serialize_entry(&"type", &"bitOr")?;
238                map.serialize_entry(&"bitOr", value)?;
239            }
240            NumericSeries::BitXor(value) => {
241                map.serialize_entry(&"type", &"bitXor")?;
242                map.serialize_entry(&"bitXor", value)?;
243            }
244            NumericSeries::BitShiftRight(value) => {
245                map.serialize_entry(&"type", &"bitShiftRight")?;
246                map.serialize_entry(&"bitShiftRight", value)?;
247            }
248            NumericSeries::BitShiftLeft(value) => {
249                map.serialize_entry(&"type", &"bitShiftLeft")?;
250                map.serialize_entry(&"bitShiftLeft", value)?;
251            }
252            NumericSeries::BitTest(value) => {
253                map.serialize_entry(&"type", &"bitTest")?;
254                map.serialize_entry(&"bitTest", value)?;
255            }
256            NumericSeries::IfElse(value) => {
257                map.serialize_entry(&"type", &"ifElse")?;
258                map.serialize_entry(&"ifElse", value)?;
259            }
260            NumericSeries::NumericAggregation(value) => {
261                map.serialize_entry(&"type", &"numericAggregation")?;
262                map.serialize_entry(&"numericAggregation", value)?;
263            }
264            NumericSeries::CountDuplicate(value) => {
265                map.serialize_entry(&"type", &"countDuplicate")?;
266                map.serialize_entry(&"countDuplicate", value)?;
267            }
268            NumericSeries::CumulativeSum(value) => {
269                map.serialize_entry(&"type", &"cumulativeSum")?;
270                map.serialize_entry(&"cumulativeSum", value)?;
271            }
272            NumericSeries::Derivative(value) => {
273                map.serialize_entry(&"type", &"derivative")?;
274                map.serialize_entry(&"derivative", value)?;
275            }
276            NumericSeries::Integral(value) => {
277                map.serialize_entry(&"type", &"integral")?;
278                map.serialize_entry(&"integral", value)?;
279            }
280            NumericSeries::ZScore(value) => {
281                map.serialize_entry(&"type", &"zScore")?;
282                map.serialize_entry(&"zScore", value)?;
283            }
284            NumericSeries::Raw(value) => {
285                map.serialize_entry(&"type", &"raw")?;
286                map.serialize_entry(&"raw", value)?;
287            }
288            NumericSeries::Derived(value) => {
289                map.serialize_entry(&"type", &"derived")?;
290                map.serialize_entry(&"derived", value)?;
291            }
292            NumericSeries::Resample(value) => {
293                map.serialize_entry(&"type", &"resample")?;
294                map.serialize_entry(&"resample", value)?;
295            }
296            NumericSeries::NthPointDownsample(value) => {
297                map.serialize_entry(&"type", &"nthPointDownsample")?;
298                map.serialize_entry(&"nthPointDownsample", value)?;
299            }
300            NumericSeries::LargestTriangleThreeBuckets(value) => {
301                map.serialize_entry(&"type", &"largestTriangleThreeBuckets")?;
302                map.serialize_entry(&"largestTriangleThreeBuckets", value)?;
303            }
304            NumericSeries::SignalFilter(value) => {
305                map.serialize_entry(&"type", &"signalFilter")?;
306                map.serialize_entry(&"signalFilter", value)?;
307            }
308            NumericSeries::TimeDifference(value) => {
309                map.serialize_entry(&"type", &"timeDifference")?;
310                map.serialize_entry(&"timeDifference", value)?;
311            }
312            NumericSeries::AbsoluteTimestamp(value) => {
313                map.serialize_entry(&"type", &"absoluteTimestamp")?;
314                map.serialize_entry(&"absoluteTimestamp", value)?;
315            }
316            NumericSeries::TimeRangeFilter(value) => {
317                map.serialize_entry(&"type", &"timeRangeFilter")?;
318                map.serialize_entry(&"timeRangeFilter", value)?;
319            }
320            NumericSeries::TimeShift(value) => {
321                map.serialize_entry(&"type", &"timeShift")?;
322                map.serialize_entry(&"timeShift", value)?;
323            }
324            NumericSeries::TimeShiftV2(value) => {
325                map.serialize_entry(&"type", &"timeShiftV2")?;
326                map.serialize_entry(&"timeShiftV2", value)?;
327            }
328            NumericSeries::UnitConversion(value) => {
329                map.serialize_entry(&"type", &"unitConversion")?;
330                map.serialize_entry(&"unitConversion", value)?;
331            }
332            NumericSeries::ValueDifference(value) => {
333                map.serialize_entry(&"type", &"valueDifference")?;
334                map.serialize_entry(&"valueDifference", value)?;
335            }
336            NumericSeries::FilterTransformation(value) => {
337                map.serialize_entry(&"type", &"filterTransformation")?;
338                map.serialize_entry(&"filterTransformation", value)?;
339            }
340            NumericSeries::ThresholdFilter(value) => {
341                map.serialize_entry(&"type", &"thresholdFilter")?;
342                map.serialize_entry(&"thresholdFilter", value)?;
343            }
344            NumericSeries::ApproximateFilter(value) => {
345                map.serialize_entry(&"type", &"approximateFilter")?;
346                map.serialize_entry(&"approximateFilter", value)?;
347            }
348            NumericSeries::DropNan(value) => {
349                map.serialize_entry(&"type", &"dropNan")?;
350                map.serialize_entry(&"dropNan", value)?;
351            }
352            NumericSeries::Select1dArrayIndex(value) => {
353                map.serialize_entry(&"type", &"select1dArrayIndex")?;
354                map.serialize_entry(&"select1dArrayIndex", value)?;
355            }
356            NumericSeries::AggregateUnderRanges(value) => {
357                map.serialize_entry(&"type", &"aggregateUnderRanges")?;
358                map.serialize_entry(&"aggregateUnderRanges", value)?;
359            }
360            NumericSeries::FilterByExpression(value) => {
361                map.serialize_entry(&"type", &"filterByExpression")?;
362                map.serialize_entry(&"filterByExpression", value)?;
363            }
364            NumericSeries::ScalarUdf(value) => {
365                map.serialize_entry(&"type", &"scalarUdf")?;
366                map.serialize_entry(&"scalarUdf", value)?;
367            }
368            NumericSeries::EnumToNumeric(value) => {
369                map.serialize_entry(&"type", &"enumToNumeric")?;
370                map.serialize_entry(&"enumToNumeric", value)?;
371            }
372            NumericSeries::Refprop(value) => {
373                map.serialize_entry(&"type", &"refprop")?;
374                map.serialize_entry(&"refprop", value)?;
375            }
376            NumericSeries::ExtractFromStruct(value) => {
377                map.serialize_entry(&"type", &"extractFromStruct")?;
378                map.serialize_entry(&"extractFromStruct", value)?;
379            }
380            NumericSeries::TagByIntervals(value) => {
381                map.serialize_entry(&"type", &"tagByIntervals")?;
382                map.serialize_entry(&"tagByIntervals", value)?;
383            }
384            NumericSeries::FilterByTag(value) => {
385                map.serialize_entry(&"type", &"filterByTag")?;
386                map.serialize_entry(&"filterByTag", value)?;
387            }
388            NumericSeries::SelectTags(value) => {
389                map.serialize_entry(&"type", &"selectTags")?;
390                map.serialize_entry(&"selectTags", value)?;
391            }
392            NumericSeries::ToStartOfInterval(value) => {
393                map.serialize_entry(&"type", &"toStartOfInterval")?;
394                map.serialize_entry(&"toStartOfInterval", value)?;
395            }
396            NumericSeries::PhaseUnwrap(value) => {
397                map.serialize_entry(&"type", &"phaseUnwrap")?;
398                map.serialize_entry(&"phaseUnwrap", value)?;
399            }
400            #[allow(deprecated)]
401            NumericSeries::Aggregate(value) => {
402                map.serialize_entry(&"type", &"aggregate")?;
403                map.serialize_entry(&"aggregate", value)?;
404            }
405            #[allow(deprecated)]
406            NumericSeries::RollingOperation(value) => {
407                map.serialize_entry(&"type", &"rollingOperation")?;
408                map.serialize_entry(&"rollingOperation", value)?;
409            }
410            #[allow(deprecated)]
411            NumericSeries::BitOperation(value) => {
412                map.serialize_entry(&"type", &"bitOperation")?;
413                map.serialize_entry(&"bitOperation", value)?;
414            }
415            #[allow(deprecated)]
416            NumericSeries::Channel(value) => {
417                map.serialize_entry(&"type", &"channel")?;
418                map.serialize_entry(&"channel", value)?;
419            }
420            #[allow(deprecated)]
421            NumericSeries::Offset(value) => {
422                map.serialize_entry(&"type", &"offset")?;
423                map.serialize_entry(&"offset", value)?;
424            }
425            #[allow(deprecated)]
426            NumericSeries::Scale(value) => {
427                map.serialize_entry(&"type", &"scale")?;
428                map.serialize_entry(&"scale", value)?;
429            }
430            #[allow(deprecated)]
431            NumericSeries::Arithmetic(value) => {
432                map.serialize_entry(&"type", &"arithmetic")?;
433                map.serialize_entry(&"arithmetic", value)?;
434            }
435            #[allow(deprecated)]
436            NumericSeries::UnaryArithmetic(value) => {
437                map.serialize_entry(&"type", &"unaryArithmetic")?;
438                map.serialize_entry(&"unaryArithmetic", value)?;
439            }
440            #[allow(deprecated)]
441            NumericSeries::BinaryArithmetic(value) => {
442                map.serialize_entry(&"type", &"binaryArithmetic")?;
443                map.serialize_entry(&"binaryArithmetic", value)?;
444            }
445            NumericSeries::Unknown(value) => {
446                map.serialize_entry(&"type", &value.type_)?;
447                map.serialize_entry(&value.type_, &value.value)?;
448            }
449        }
450        map.end()
451    }
452}
453impl<'de> de::Deserialize<'de> for NumericSeries {
454    fn deserialize<D>(d: D) -> Result<NumericSeries, D::Error>
455    where
456        D: de::Deserializer<'de>,
457    {
458        d.deserialize_map(Visitor_)
459    }
460}
461struct Visitor_;
462impl<'de> de::Visitor<'de> for Visitor_ {
463    type Value = NumericSeries;
464    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
465        fmt.write_str("union NumericSeries")
466    }
467    fn visit_map<A>(self, mut map: A) -> Result<NumericSeries, A::Error>
468    where
469        A: de::MapAccess<'de>,
470    {
471        let v = match map.next_key::<UnionField_<Variant_>>()? {
472            Some(UnionField_::Type) => {
473                let variant = map.next_value()?;
474                let key = map.next_key()?;
475                match (variant, key) {
476                    (Variant_::Abs, Some(Variant_::Abs)) => {
477                        let value = map.next_value()?;
478                        NumericSeries::Abs(value)
479                    }
480                    (Variant_::Negate, Some(Variant_::Negate)) => {
481                        let value = map.next_value()?;
482                        NumericSeries::Negate(value)
483                    }
484                    (Variant_::Cos, Some(Variant_::Cos)) => {
485                        let value = map.next_value()?;
486                        NumericSeries::Cos(value)
487                    }
488                    (Variant_::Sin, Some(Variant_::Sin)) => {
489                        let value = map.next_value()?;
490                        NumericSeries::Sin(value)
491                    }
492                    (Variant_::Tan, Some(Variant_::Tan)) => {
493                        let value = map.next_value()?;
494                        NumericSeries::Tan(value)
495                    }
496                    (Variant_::Acos, Some(Variant_::Acos)) => {
497                        let value = map.next_value()?;
498                        NumericSeries::Acos(value)
499                    }
500                    (Variant_::Asin, Some(Variant_::Asin)) => {
501                        let value = map.next_value()?;
502                        NumericSeries::Asin(value)
503                    }
504                    (Variant_::Ln, Some(Variant_::Ln)) => {
505                        let value = map.next_value()?;
506                        NumericSeries::Ln(value)
507                    }
508                    (Variant_::Log10, Some(Variant_::Log10)) => {
509                        let value = map.next_value()?;
510                        NumericSeries::Log10(value)
511                    }
512                    (Variant_::Sqrt, Some(Variant_::Sqrt)) => {
513                        let value = map.next_value()?;
514                        NumericSeries::Sqrt(value)
515                    }
516                    (Variant_::Add, Some(Variant_::Add)) => {
517                        let value = map.next_value()?;
518                        NumericSeries::Add(value)
519                    }
520                    (Variant_::Subtract, Some(Variant_::Subtract)) => {
521                        let value = map.next_value()?;
522                        NumericSeries::Subtract(value)
523                    }
524                    (Variant_::Multiply, Some(Variant_::Multiply)) => {
525                        let value = map.next_value()?;
526                        NumericSeries::Multiply(value)
527                    }
528                    (Variant_::Divide, Some(Variant_::Divide)) => {
529                        let value = map.next_value()?;
530                        NumericSeries::Divide(value)
531                    }
532                    (Variant_::FloorDivide, Some(Variant_::FloorDivide)) => {
533                        let value = map.next_value()?;
534                        NumericSeries::FloorDivide(value)
535                    }
536                    (Variant_::Power, Some(Variant_::Power)) => {
537                        let value = map.next_value()?;
538                        NumericSeries::Power(value)
539                    }
540                    (Variant_::Modulo, Some(Variant_::Modulo)) => {
541                        let value = map.next_value()?;
542                        NumericSeries::Modulo(value)
543                    }
544                    (Variant_::Atan2, Some(Variant_::Atan2)) => {
545                        let value = map.next_value()?;
546                        NumericSeries::Atan2(value)
547                    }
548                    (Variant_::Max, Some(Variant_::Max)) => {
549                        let value = map.next_value()?;
550                        NumericSeries::Max(value)
551                    }
552                    (Variant_::Mean, Some(Variant_::Mean)) => {
553                        let value = map.next_value()?;
554                        NumericSeries::Mean(value)
555                    }
556                    (Variant_::Min, Some(Variant_::Min)) => {
557                        let value = map.next_value()?;
558                        NumericSeries::Min(value)
559                    }
560                    (Variant_::Sum, Some(Variant_::Sum)) => {
561                        let value = map.next_value()?;
562                        NumericSeries::Sum(value)
563                    }
564                    (Variant_::Union, Some(Variant_::Union)) => {
565                        let value = map.next_value()?;
566                        NumericSeries::Union(value)
567                    }
568                    (Variant_::Product, Some(Variant_::Product)) => {
569                        let value = map.next_value()?;
570                        NumericSeries::Product(value)
571                    }
572                    (Variant_::Constant, Some(Variant_::Constant)) => {
573                        let value = map.next_value()?;
574                        NumericSeries::Constant(value)
575                    }
576                    (
577                        Variant_::SelectNewestPoints,
578                        Some(Variant_::SelectNewestPoints),
579                    ) => {
580                        let value = map.next_value()?;
581                        NumericSeries::SelectNewestPoints(value)
582                    }
583                    (Variant_::SelectNumeric, Some(Variant_::SelectNumeric)) => {
584                        let value = map.next_value()?;
585                        NumericSeries::SelectNumeric(value)
586                    }
587                    (
588                        Variant_::SelectOldestPoints,
589                        Some(Variant_::SelectOldestPoints),
590                    ) => {
591                        let value = map.next_value()?;
592                        NumericSeries::SelectOldestPoints(value)
593                    }
594                    (Variant_::BitAnd, Some(Variant_::BitAnd)) => {
595                        let value = map.next_value()?;
596                        NumericSeries::BitAnd(value)
597                    }
598                    (Variant_::BitOr, Some(Variant_::BitOr)) => {
599                        let value = map.next_value()?;
600                        NumericSeries::BitOr(value)
601                    }
602                    (Variant_::BitXor, Some(Variant_::BitXor)) => {
603                        let value = map.next_value()?;
604                        NumericSeries::BitXor(value)
605                    }
606                    (Variant_::BitShiftRight, Some(Variant_::BitShiftRight)) => {
607                        let value = map.next_value()?;
608                        NumericSeries::BitShiftRight(value)
609                    }
610                    (Variant_::BitShiftLeft, Some(Variant_::BitShiftLeft)) => {
611                        let value = map.next_value()?;
612                        NumericSeries::BitShiftLeft(value)
613                    }
614                    (Variant_::BitTest, Some(Variant_::BitTest)) => {
615                        let value = map.next_value()?;
616                        NumericSeries::BitTest(value)
617                    }
618                    (Variant_::IfElse, Some(Variant_::IfElse)) => {
619                        let value = map.next_value()?;
620                        NumericSeries::IfElse(value)
621                    }
622                    (
623                        Variant_::NumericAggregation,
624                        Some(Variant_::NumericAggregation),
625                    ) => {
626                        let value = map.next_value()?;
627                        NumericSeries::NumericAggregation(value)
628                    }
629                    (Variant_::CountDuplicate, Some(Variant_::CountDuplicate)) => {
630                        let value = map.next_value()?;
631                        NumericSeries::CountDuplicate(value)
632                    }
633                    (Variant_::CumulativeSum, Some(Variant_::CumulativeSum)) => {
634                        let value = map.next_value()?;
635                        NumericSeries::CumulativeSum(value)
636                    }
637                    (Variant_::Derivative, Some(Variant_::Derivative)) => {
638                        let value = map.next_value()?;
639                        NumericSeries::Derivative(value)
640                    }
641                    (Variant_::Integral, Some(Variant_::Integral)) => {
642                        let value = map.next_value()?;
643                        NumericSeries::Integral(value)
644                    }
645                    (Variant_::ZScore, Some(Variant_::ZScore)) => {
646                        let value = map.next_value()?;
647                        NumericSeries::ZScore(value)
648                    }
649                    (Variant_::Raw, Some(Variant_::Raw)) => {
650                        let value = map.next_value()?;
651                        NumericSeries::Raw(value)
652                    }
653                    (Variant_::Derived, Some(Variant_::Derived)) => {
654                        let value = map.next_value()?;
655                        NumericSeries::Derived(value)
656                    }
657                    (Variant_::Resample, Some(Variant_::Resample)) => {
658                        let value = map.next_value()?;
659                        NumericSeries::Resample(value)
660                    }
661                    (
662                        Variant_::NthPointDownsample,
663                        Some(Variant_::NthPointDownsample),
664                    ) => {
665                        let value = map.next_value()?;
666                        NumericSeries::NthPointDownsample(value)
667                    }
668                    (
669                        Variant_::LargestTriangleThreeBuckets,
670                        Some(Variant_::LargestTriangleThreeBuckets),
671                    ) => {
672                        let value = map.next_value()?;
673                        NumericSeries::LargestTriangleThreeBuckets(value)
674                    }
675                    (Variant_::SignalFilter, Some(Variant_::SignalFilter)) => {
676                        let value = map.next_value()?;
677                        NumericSeries::SignalFilter(value)
678                    }
679                    (Variant_::TimeDifference, Some(Variant_::TimeDifference)) => {
680                        let value = map.next_value()?;
681                        NumericSeries::TimeDifference(value)
682                    }
683                    (Variant_::AbsoluteTimestamp, Some(Variant_::AbsoluteTimestamp)) => {
684                        let value = map.next_value()?;
685                        NumericSeries::AbsoluteTimestamp(value)
686                    }
687                    (Variant_::TimeRangeFilter, Some(Variant_::TimeRangeFilter)) => {
688                        let value = map.next_value()?;
689                        NumericSeries::TimeRangeFilter(value)
690                    }
691                    (Variant_::TimeShift, Some(Variant_::TimeShift)) => {
692                        let value = map.next_value()?;
693                        NumericSeries::TimeShift(value)
694                    }
695                    (Variant_::TimeShiftV2, Some(Variant_::TimeShiftV2)) => {
696                        let value = map.next_value()?;
697                        NumericSeries::TimeShiftV2(value)
698                    }
699                    (Variant_::UnitConversion, Some(Variant_::UnitConversion)) => {
700                        let value = map.next_value()?;
701                        NumericSeries::UnitConversion(value)
702                    }
703                    (Variant_::ValueDifference, Some(Variant_::ValueDifference)) => {
704                        let value = map.next_value()?;
705                        NumericSeries::ValueDifference(value)
706                    }
707                    (
708                        Variant_::FilterTransformation,
709                        Some(Variant_::FilterTransformation),
710                    ) => {
711                        let value = map.next_value()?;
712                        NumericSeries::FilterTransformation(value)
713                    }
714                    (Variant_::ThresholdFilter, Some(Variant_::ThresholdFilter)) => {
715                        let value = map.next_value()?;
716                        NumericSeries::ThresholdFilter(value)
717                    }
718                    (Variant_::ApproximateFilter, Some(Variant_::ApproximateFilter)) => {
719                        let value = map.next_value()?;
720                        NumericSeries::ApproximateFilter(value)
721                    }
722                    (Variant_::DropNan, Some(Variant_::DropNan)) => {
723                        let value = map.next_value()?;
724                        NumericSeries::DropNan(value)
725                    }
726                    (
727                        Variant_::Select1dArrayIndex,
728                        Some(Variant_::Select1dArrayIndex),
729                    ) => {
730                        let value = map.next_value()?;
731                        NumericSeries::Select1dArrayIndex(value)
732                    }
733                    (
734                        Variant_::AggregateUnderRanges,
735                        Some(Variant_::AggregateUnderRanges),
736                    ) => {
737                        let value = map.next_value()?;
738                        NumericSeries::AggregateUnderRanges(value)
739                    }
740                    (
741                        Variant_::FilterByExpression,
742                        Some(Variant_::FilterByExpression),
743                    ) => {
744                        let value = map.next_value()?;
745                        NumericSeries::FilterByExpression(value)
746                    }
747                    (Variant_::ScalarUdf, Some(Variant_::ScalarUdf)) => {
748                        let value = map.next_value()?;
749                        NumericSeries::ScalarUdf(value)
750                    }
751                    (Variant_::EnumToNumeric, Some(Variant_::EnumToNumeric)) => {
752                        let value = map.next_value()?;
753                        NumericSeries::EnumToNumeric(value)
754                    }
755                    (Variant_::Refprop, Some(Variant_::Refprop)) => {
756                        let value = map.next_value()?;
757                        NumericSeries::Refprop(value)
758                    }
759                    (Variant_::ExtractFromStruct, Some(Variant_::ExtractFromStruct)) => {
760                        let value = map.next_value()?;
761                        NumericSeries::ExtractFromStruct(value)
762                    }
763                    (Variant_::TagByIntervals, Some(Variant_::TagByIntervals)) => {
764                        let value = map.next_value()?;
765                        NumericSeries::TagByIntervals(value)
766                    }
767                    (Variant_::FilterByTag, Some(Variant_::FilterByTag)) => {
768                        let value = map.next_value()?;
769                        NumericSeries::FilterByTag(value)
770                    }
771                    (Variant_::SelectTags, Some(Variant_::SelectTags)) => {
772                        let value = map.next_value()?;
773                        NumericSeries::SelectTags(value)
774                    }
775                    (Variant_::ToStartOfInterval, Some(Variant_::ToStartOfInterval)) => {
776                        let value = map.next_value()?;
777                        NumericSeries::ToStartOfInterval(value)
778                    }
779                    (Variant_::PhaseUnwrap, Some(Variant_::PhaseUnwrap)) => {
780                        let value = map.next_value()?;
781                        NumericSeries::PhaseUnwrap(value)
782                    }
783                    #[allow(deprecated)]
784                    (Variant_::Aggregate, Some(Variant_::Aggregate)) => {
785                        let value = map.next_value()?;
786                        NumericSeries::Aggregate(value)
787                    }
788                    #[allow(deprecated)]
789                    (Variant_::RollingOperation, Some(Variant_::RollingOperation)) => {
790                        let value = map.next_value()?;
791                        NumericSeries::RollingOperation(value)
792                    }
793                    #[allow(deprecated)]
794                    (Variant_::BitOperation, Some(Variant_::BitOperation)) => {
795                        let value = map.next_value()?;
796                        NumericSeries::BitOperation(value)
797                    }
798                    #[allow(deprecated)]
799                    (Variant_::Channel, Some(Variant_::Channel)) => {
800                        let value = map.next_value()?;
801                        NumericSeries::Channel(value)
802                    }
803                    #[allow(deprecated)]
804                    (Variant_::Offset, Some(Variant_::Offset)) => {
805                        let value = map.next_value()?;
806                        NumericSeries::Offset(value)
807                    }
808                    #[allow(deprecated)]
809                    (Variant_::Scale, Some(Variant_::Scale)) => {
810                        let value = map.next_value()?;
811                        NumericSeries::Scale(value)
812                    }
813                    #[allow(deprecated)]
814                    (Variant_::Arithmetic, Some(Variant_::Arithmetic)) => {
815                        let value = map.next_value()?;
816                        NumericSeries::Arithmetic(value)
817                    }
818                    #[allow(deprecated)]
819                    (Variant_::UnaryArithmetic, Some(Variant_::UnaryArithmetic)) => {
820                        let value = map.next_value()?;
821                        NumericSeries::UnaryArithmetic(value)
822                    }
823                    #[allow(deprecated)]
824                    (Variant_::BinaryArithmetic, Some(Variant_::BinaryArithmetic)) => {
825                        let value = map.next_value()?;
826                        NumericSeries::BinaryArithmetic(value)
827                    }
828                    (Variant_::Unknown(type_), Some(Variant_::Unknown(b))) => {
829                        if type_ == b {
830                            let value = map.next_value()?;
831                            NumericSeries::Unknown(Unknown { type_, value })
832                        } else {
833                            return Err(
834                                de::Error::invalid_value(de::Unexpected::Str(&type_), &&*b),
835                            )
836                        }
837                    }
838                    (variant, Some(key)) => {
839                        return Err(
840                            de::Error::invalid_value(
841                                de::Unexpected::Str(key.as_str()),
842                                &variant.as_str(),
843                            ),
844                        );
845                    }
846                    (variant, None) => {
847                        return Err(de::Error::missing_field(variant.as_str()));
848                    }
849                }
850            }
851            Some(UnionField_::Value(variant)) => {
852                let value = match &variant {
853                    Variant_::Abs => {
854                        let value = map.next_value()?;
855                        NumericSeries::Abs(value)
856                    }
857                    Variant_::Negate => {
858                        let value = map.next_value()?;
859                        NumericSeries::Negate(value)
860                    }
861                    Variant_::Cos => {
862                        let value = map.next_value()?;
863                        NumericSeries::Cos(value)
864                    }
865                    Variant_::Sin => {
866                        let value = map.next_value()?;
867                        NumericSeries::Sin(value)
868                    }
869                    Variant_::Tan => {
870                        let value = map.next_value()?;
871                        NumericSeries::Tan(value)
872                    }
873                    Variant_::Acos => {
874                        let value = map.next_value()?;
875                        NumericSeries::Acos(value)
876                    }
877                    Variant_::Asin => {
878                        let value = map.next_value()?;
879                        NumericSeries::Asin(value)
880                    }
881                    Variant_::Ln => {
882                        let value = map.next_value()?;
883                        NumericSeries::Ln(value)
884                    }
885                    Variant_::Log10 => {
886                        let value = map.next_value()?;
887                        NumericSeries::Log10(value)
888                    }
889                    Variant_::Sqrt => {
890                        let value = map.next_value()?;
891                        NumericSeries::Sqrt(value)
892                    }
893                    Variant_::Add => {
894                        let value = map.next_value()?;
895                        NumericSeries::Add(value)
896                    }
897                    Variant_::Subtract => {
898                        let value = map.next_value()?;
899                        NumericSeries::Subtract(value)
900                    }
901                    Variant_::Multiply => {
902                        let value = map.next_value()?;
903                        NumericSeries::Multiply(value)
904                    }
905                    Variant_::Divide => {
906                        let value = map.next_value()?;
907                        NumericSeries::Divide(value)
908                    }
909                    Variant_::FloorDivide => {
910                        let value = map.next_value()?;
911                        NumericSeries::FloorDivide(value)
912                    }
913                    Variant_::Power => {
914                        let value = map.next_value()?;
915                        NumericSeries::Power(value)
916                    }
917                    Variant_::Modulo => {
918                        let value = map.next_value()?;
919                        NumericSeries::Modulo(value)
920                    }
921                    Variant_::Atan2 => {
922                        let value = map.next_value()?;
923                        NumericSeries::Atan2(value)
924                    }
925                    Variant_::Max => {
926                        let value = map.next_value()?;
927                        NumericSeries::Max(value)
928                    }
929                    Variant_::Mean => {
930                        let value = map.next_value()?;
931                        NumericSeries::Mean(value)
932                    }
933                    Variant_::Min => {
934                        let value = map.next_value()?;
935                        NumericSeries::Min(value)
936                    }
937                    Variant_::Sum => {
938                        let value = map.next_value()?;
939                        NumericSeries::Sum(value)
940                    }
941                    Variant_::Union => {
942                        let value = map.next_value()?;
943                        NumericSeries::Union(value)
944                    }
945                    Variant_::Product => {
946                        let value = map.next_value()?;
947                        NumericSeries::Product(value)
948                    }
949                    Variant_::Constant => {
950                        let value = map.next_value()?;
951                        NumericSeries::Constant(value)
952                    }
953                    Variant_::SelectNewestPoints => {
954                        let value = map.next_value()?;
955                        NumericSeries::SelectNewestPoints(value)
956                    }
957                    Variant_::SelectNumeric => {
958                        let value = map.next_value()?;
959                        NumericSeries::SelectNumeric(value)
960                    }
961                    Variant_::SelectOldestPoints => {
962                        let value = map.next_value()?;
963                        NumericSeries::SelectOldestPoints(value)
964                    }
965                    Variant_::BitAnd => {
966                        let value = map.next_value()?;
967                        NumericSeries::BitAnd(value)
968                    }
969                    Variant_::BitOr => {
970                        let value = map.next_value()?;
971                        NumericSeries::BitOr(value)
972                    }
973                    Variant_::BitXor => {
974                        let value = map.next_value()?;
975                        NumericSeries::BitXor(value)
976                    }
977                    Variant_::BitShiftRight => {
978                        let value = map.next_value()?;
979                        NumericSeries::BitShiftRight(value)
980                    }
981                    Variant_::BitShiftLeft => {
982                        let value = map.next_value()?;
983                        NumericSeries::BitShiftLeft(value)
984                    }
985                    Variant_::BitTest => {
986                        let value = map.next_value()?;
987                        NumericSeries::BitTest(value)
988                    }
989                    Variant_::IfElse => {
990                        let value = map.next_value()?;
991                        NumericSeries::IfElse(value)
992                    }
993                    Variant_::NumericAggregation => {
994                        let value = map.next_value()?;
995                        NumericSeries::NumericAggregation(value)
996                    }
997                    Variant_::CountDuplicate => {
998                        let value = map.next_value()?;
999                        NumericSeries::CountDuplicate(value)
1000                    }
1001                    Variant_::CumulativeSum => {
1002                        let value = map.next_value()?;
1003                        NumericSeries::CumulativeSum(value)
1004                    }
1005                    Variant_::Derivative => {
1006                        let value = map.next_value()?;
1007                        NumericSeries::Derivative(value)
1008                    }
1009                    Variant_::Integral => {
1010                        let value = map.next_value()?;
1011                        NumericSeries::Integral(value)
1012                    }
1013                    Variant_::ZScore => {
1014                        let value = map.next_value()?;
1015                        NumericSeries::ZScore(value)
1016                    }
1017                    Variant_::Raw => {
1018                        let value = map.next_value()?;
1019                        NumericSeries::Raw(value)
1020                    }
1021                    Variant_::Derived => {
1022                        let value = map.next_value()?;
1023                        NumericSeries::Derived(value)
1024                    }
1025                    Variant_::Resample => {
1026                        let value = map.next_value()?;
1027                        NumericSeries::Resample(value)
1028                    }
1029                    Variant_::NthPointDownsample => {
1030                        let value = map.next_value()?;
1031                        NumericSeries::NthPointDownsample(value)
1032                    }
1033                    Variant_::LargestTriangleThreeBuckets => {
1034                        let value = map.next_value()?;
1035                        NumericSeries::LargestTriangleThreeBuckets(value)
1036                    }
1037                    Variant_::SignalFilter => {
1038                        let value = map.next_value()?;
1039                        NumericSeries::SignalFilter(value)
1040                    }
1041                    Variant_::TimeDifference => {
1042                        let value = map.next_value()?;
1043                        NumericSeries::TimeDifference(value)
1044                    }
1045                    Variant_::AbsoluteTimestamp => {
1046                        let value = map.next_value()?;
1047                        NumericSeries::AbsoluteTimestamp(value)
1048                    }
1049                    Variant_::TimeRangeFilter => {
1050                        let value = map.next_value()?;
1051                        NumericSeries::TimeRangeFilter(value)
1052                    }
1053                    Variant_::TimeShift => {
1054                        let value = map.next_value()?;
1055                        NumericSeries::TimeShift(value)
1056                    }
1057                    Variant_::TimeShiftV2 => {
1058                        let value = map.next_value()?;
1059                        NumericSeries::TimeShiftV2(value)
1060                    }
1061                    Variant_::UnitConversion => {
1062                        let value = map.next_value()?;
1063                        NumericSeries::UnitConversion(value)
1064                    }
1065                    Variant_::ValueDifference => {
1066                        let value = map.next_value()?;
1067                        NumericSeries::ValueDifference(value)
1068                    }
1069                    Variant_::FilterTransformation => {
1070                        let value = map.next_value()?;
1071                        NumericSeries::FilterTransformation(value)
1072                    }
1073                    Variant_::ThresholdFilter => {
1074                        let value = map.next_value()?;
1075                        NumericSeries::ThresholdFilter(value)
1076                    }
1077                    Variant_::ApproximateFilter => {
1078                        let value = map.next_value()?;
1079                        NumericSeries::ApproximateFilter(value)
1080                    }
1081                    Variant_::DropNan => {
1082                        let value = map.next_value()?;
1083                        NumericSeries::DropNan(value)
1084                    }
1085                    Variant_::Select1dArrayIndex => {
1086                        let value = map.next_value()?;
1087                        NumericSeries::Select1dArrayIndex(value)
1088                    }
1089                    Variant_::AggregateUnderRanges => {
1090                        let value = map.next_value()?;
1091                        NumericSeries::AggregateUnderRanges(value)
1092                    }
1093                    Variant_::FilterByExpression => {
1094                        let value = map.next_value()?;
1095                        NumericSeries::FilterByExpression(value)
1096                    }
1097                    Variant_::ScalarUdf => {
1098                        let value = map.next_value()?;
1099                        NumericSeries::ScalarUdf(value)
1100                    }
1101                    Variant_::EnumToNumeric => {
1102                        let value = map.next_value()?;
1103                        NumericSeries::EnumToNumeric(value)
1104                    }
1105                    Variant_::Refprop => {
1106                        let value = map.next_value()?;
1107                        NumericSeries::Refprop(value)
1108                    }
1109                    Variant_::ExtractFromStruct => {
1110                        let value = map.next_value()?;
1111                        NumericSeries::ExtractFromStruct(value)
1112                    }
1113                    Variant_::TagByIntervals => {
1114                        let value = map.next_value()?;
1115                        NumericSeries::TagByIntervals(value)
1116                    }
1117                    Variant_::FilterByTag => {
1118                        let value = map.next_value()?;
1119                        NumericSeries::FilterByTag(value)
1120                    }
1121                    Variant_::SelectTags => {
1122                        let value = map.next_value()?;
1123                        NumericSeries::SelectTags(value)
1124                    }
1125                    Variant_::ToStartOfInterval => {
1126                        let value = map.next_value()?;
1127                        NumericSeries::ToStartOfInterval(value)
1128                    }
1129                    Variant_::PhaseUnwrap => {
1130                        let value = map.next_value()?;
1131                        NumericSeries::PhaseUnwrap(value)
1132                    }
1133                    Variant_::Aggregate => {
1134                        let value = map.next_value()?;
1135                        #[allow(deprecated)] NumericSeries::Aggregate(value)
1136                    }
1137                    Variant_::RollingOperation => {
1138                        let value = map.next_value()?;
1139                        #[allow(deprecated)] NumericSeries::RollingOperation(value)
1140                    }
1141                    Variant_::BitOperation => {
1142                        let value = map.next_value()?;
1143                        #[allow(deprecated)] NumericSeries::BitOperation(value)
1144                    }
1145                    Variant_::Channel => {
1146                        let value = map.next_value()?;
1147                        #[allow(deprecated)] NumericSeries::Channel(value)
1148                    }
1149                    Variant_::Offset => {
1150                        let value = map.next_value()?;
1151                        #[allow(deprecated)] NumericSeries::Offset(value)
1152                    }
1153                    Variant_::Scale => {
1154                        let value = map.next_value()?;
1155                        #[allow(deprecated)] NumericSeries::Scale(value)
1156                    }
1157                    Variant_::Arithmetic => {
1158                        let value = map.next_value()?;
1159                        #[allow(deprecated)] NumericSeries::Arithmetic(value)
1160                    }
1161                    Variant_::UnaryArithmetic => {
1162                        let value = map.next_value()?;
1163                        #[allow(deprecated)] NumericSeries::UnaryArithmetic(value)
1164                    }
1165                    Variant_::BinaryArithmetic => {
1166                        let value = map.next_value()?;
1167                        #[allow(deprecated)] NumericSeries::BinaryArithmetic(value)
1168                    }
1169                    Variant_::Unknown(type_) => {
1170                        let value = map.next_value()?;
1171                        NumericSeries::Unknown(Unknown {
1172                            type_: type_.clone(),
1173                            value,
1174                        })
1175                    }
1176                };
1177                if map.next_key::<UnionTypeField_>()?.is_none() {
1178                    return Err(de::Error::missing_field("type"));
1179                }
1180                let type_variant = map.next_value::<Variant_>()?;
1181                if variant != type_variant {
1182                    return Err(
1183                        de::Error::invalid_value(
1184                            de::Unexpected::Str(type_variant.as_str()),
1185                            &variant.as_str(),
1186                        ),
1187                    );
1188                }
1189                value
1190            }
1191            None => return Err(de::Error::missing_field("type")),
1192        };
1193        if map.next_key::<UnionField_<Variant_>>()?.is_some() {
1194            return Err(de::Error::invalid_length(3, &"type and value fields"));
1195        }
1196        Ok(v)
1197    }
1198}
1199#[derive(PartialEq)]
1200enum Variant_ {
1201    Abs,
1202    Negate,
1203    Cos,
1204    Sin,
1205    Tan,
1206    Acos,
1207    Asin,
1208    Ln,
1209    Log10,
1210    Sqrt,
1211    Add,
1212    Subtract,
1213    Multiply,
1214    Divide,
1215    FloorDivide,
1216    Power,
1217    Modulo,
1218    Atan2,
1219    Max,
1220    Mean,
1221    Min,
1222    Sum,
1223    Union,
1224    Product,
1225    Constant,
1226    SelectNewestPoints,
1227    SelectNumeric,
1228    SelectOldestPoints,
1229    BitAnd,
1230    BitOr,
1231    BitXor,
1232    BitShiftRight,
1233    BitShiftLeft,
1234    BitTest,
1235    IfElse,
1236    NumericAggregation,
1237    CountDuplicate,
1238    CumulativeSum,
1239    Derivative,
1240    Integral,
1241    ZScore,
1242    Raw,
1243    Derived,
1244    Resample,
1245    NthPointDownsample,
1246    LargestTriangleThreeBuckets,
1247    SignalFilter,
1248    TimeDifference,
1249    AbsoluteTimestamp,
1250    TimeRangeFilter,
1251    TimeShift,
1252    TimeShiftV2,
1253    UnitConversion,
1254    ValueDifference,
1255    FilterTransformation,
1256    ThresholdFilter,
1257    ApproximateFilter,
1258    DropNan,
1259    Select1dArrayIndex,
1260    AggregateUnderRanges,
1261    FilterByExpression,
1262    ScalarUdf,
1263    EnumToNumeric,
1264    Refprop,
1265    ExtractFromStruct,
1266    TagByIntervals,
1267    FilterByTag,
1268    SelectTags,
1269    ToStartOfInterval,
1270    PhaseUnwrap,
1271    Aggregate,
1272    RollingOperation,
1273    BitOperation,
1274    Channel,
1275    Offset,
1276    Scale,
1277    Arithmetic,
1278    UnaryArithmetic,
1279    BinaryArithmetic,
1280    Unknown(Box<str>),
1281}
1282impl Variant_ {
1283    fn as_str(&self) -> &'static str {
1284        match *self {
1285            Variant_::Abs => "abs",
1286            Variant_::Negate => "negate",
1287            Variant_::Cos => "cos",
1288            Variant_::Sin => "sin",
1289            Variant_::Tan => "tan",
1290            Variant_::Acos => "acos",
1291            Variant_::Asin => "asin",
1292            Variant_::Ln => "ln",
1293            Variant_::Log10 => "log10",
1294            Variant_::Sqrt => "sqrt",
1295            Variant_::Add => "add",
1296            Variant_::Subtract => "subtract",
1297            Variant_::Multiply => "multiply",
1298            Variant_::Divide => "divide",
1299            Variant_::FloorDivide => "floorDivide",
1300            Variant_::Power => "power",
1301            Variant_::Modulo => "modulo",
1302            Variant_::Atan2 => "atan2",
1303            Variant_::Max => "max",
1304            Variant_::Mean => "mean",
1305            Variant_::Min => "min",
1306            Variant_::Sum => "sum",
1307            Variant_::Union => "union",
1308            Variant_::Product => "product",
1309            Variant_::Constant => "constant",
1310            Variant_::SelectNewestPoints => "selectNewestPoints",
1311            Variant_::SelectNumeric => "selectNumeric",
1312            Variant_::SelectOldestPoints => "selectOldestPoints",
1313            Variant_::BitAnd => "bitAnd",
1314            Variant_::BitOr => "bitOr",
1315            Variant_::BitXor => "bitXor",
1316            Variant_::BitShiftRight => "bitShiftRight",
1317            Variant_::BitShiftLeft => "bitShiftLeft",
1318            Variant_::BitTest => "bitTest",
1319            Variant_::IfElse => "ifElse",
1320            Variant_::NumericAggregation => "numericAggregation",
1321            Variant_::CountDuplicate => "countDuplicate",
1322            Variant_::CumulativeSum => "cumulativeSum",
1323            Variant_::Derivative => "derivative",
1324            Variant_::Integral => "integral",
1325            Variant_::ZScore => "zScore",
1326            Variant_::Raw => "raw",
1327            Variant_::Derived => "derived",
1328            Variant_::Resample => "resample",
1329            Variant_::NthPointDownsample => "nthPointDownsample",
1330            Variant_::LargestTriangleThreeBuckets => "largestTriangleThreeBuckets",
1331            Variant_::SignalFilter => "signalFilter",
1332            Variant_::TimeDifference => "timeDifference",
1333            Variant_::AbsoluteTimestamp => "absoluteTimestamp",
1334            Variant_::TimeRangeFilter => "timeRangeFilter",
1335            Variant_::TimeShift => "timeShift",
1336            Variant_::TimeShiftV2 => "timeShiftV2",
1337            Variant_::UnitConversion => "unitConversion",
1338            Variant_::ValueDifference => "valueDifference",
1339            Variant_::FilterTransformation => "filterTransformation",
1340            Variant_::ThresholdFilter => "thresholdFilter",
1341            Variant_::ApproximateFilter => "approximateFilter",
1342            Variant_::DropNan => "dropNan",
1343            Variant_::Select1dArrayIndex => "select1dArrayIndex",
1344            Variant_::AggregateUnderRanges => "aggregateUnderRanges",
1345            Variant_::FilterByExpression => "filterByExpression",
1346            Variant_::ScalarUdf => "scalarUdf",
1347            Variant_::EnumToNumeric => "enumToNumeric",
1348            Variant_::Refprop => "refprop",
1349            Variant_::ExtractFromStruct => "extractFromStruct",
1350            Variant_::TagByIntervals => "tagByIntervals",
1351            Variant_::FilterByTag => "filterByTag",
1352            Variant_::SelectTags => "selectTags",
1353            Variant_::ToStartOfInterval => "toStartOfInterval",
1354            Variant_::PhaseUnwrap => "phaseUnwrap",
1355            Variant_::Aggregate => "aggregate",
1356            Variant_::RollingOperation => "rollingOperation",
1357            Variant_::BitOperation => "bitOperation",
1358            Variant_::Channel => "channel",
1359            Variant_::Offset => "offset",
1360            Variant_::Scale => "scale",
1361            Variant_::Arithmetic => "arithmetic",
1362            Variant_::UnaryArithmetic => "unaryArithmetic",
1363            Variant_::BinaryArithmetic => "binaryArithmetic",
1364            Variant_::Unknown(_) => "unknown variant",
1365        }
1366    }
1367}
1368impl<'de> de::Deserialize<'de> for Variant_ {
1369    fn deserialize<D>(d: D) -> Result<Variant_, D::Error>
1370    where
1371        D: de::Deserializer<'de>,
1372    {
1373        d.deserialize_str(VariantVisitor_)
1374    }
1375}
1376struct VariantVisitor_;
1377impl<'de> de::Visitor<'de> for VariantVisitor_ {
1378    type Value = Variant_;
1379    fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1380        fmt.write_str("string")
1381    }
1382    fn visit_str<E>(self, value: &str) -> Result<Variant_, E>
1383    where
1384        E: de::Error,
1385    {
1386        let v = match value {
1387            "abs" => Variant_::Abs,
1388            "negate" => Variant_::Negate,
1389            "cos" => Variant_::Cos,
1390            "sin" => Variant_::Sin,
1391            "tan" => Variant_::Tan,
1392            "acos" => Variant_::Acos,
1393            "asin" => Variant_::Asin,
1394            "ln" => Variant_::Ln,
1395            "log10" => Variant_::Log10,
1396            "sqrt" => Variant_::Sqrt,
1397            "add" => Variant_::Add,
1398            "subtract" => Variant_::Subtract,
1399            "multiply" => Variant_::Multiply,
1400            "divide" => Variant_::Divide,
1401            "floorDivide" => Variant_::FloorDivide,
1402            "power" => Variant_::Power,
1403            "modulo" => Variant_::Modulo,
1404            "atan2" => Variant_::Atan2,
1405            "max" => Variant_::Max,
1406            "mean" => Variant_::Mean,
1407            "min" => Variant_::Min,
1408            "sum" => Variant_::Sum,
1409            "union" => Variant_::Union,
1410            "product" => Variant_::Product,
1411            "constant" => Variant_::Constant,
1412            "selectNewestPoints" => Variant_::SelectNewestPoints,
1413            "selectNumeric" => Variant_::SelectNumeric,
1414            "selectOldestPoints" => Variant_::SelectOldestPoints,
1415            "bitAnd" => Variant_::BitAnd,
1416            "bitOr" => Variant_::BitOr,
1417            "bitXor" => Variant_::BitXor,
1418            "bitShiftRight" => Variant_::BitShiftRight,
1419            "bitShiftLeft" => Variant_::BitShiftLeft,
1420            "bitTest" => Variant_::BitTest,
1421            "ifElse" => Variant_::IfElse,
1422            "numericAggregation" => Variant_::NumericAggregation,
1423            "countDuplicate" => Variant_::CountDuplicate,
1424            "cumulativeSum" => Variant_::CumulativeSum,
1425            "derivative" => Variant_::Derivative,
1426            "integral" => Variant_::Integral,
1427            "zScore" => Variant_::ZScore,
1428            "raw" => Variant_::Raw,
1429            "derived" => Variant_::Derived,
1430            "resample" => Variant_::Resample,
1431            "nthPointDownsample" => Variant_::NthPointDownsample,
1432            "largestTriangleThreeBuckets" => Variant_::LargestTriangleThreeBuckets,
1433            "signalFilter" => Variant_::SignalFilter,
1434            "timeDifference" => Variant_::TimeDifference,
1435            "absoluteTimestamp" => Variant_::AbsoluteTimestamp,
1436            "timeRangeFilter" => Variant_::TimeRangeFilter,
1437            "timeShift" => Variant_::TimeShift,
1438            "timeShiftV2" => Variant_::TimeShiftV2,
1439            "unitConversion" => Variant_::UnitConversion,
1440            "valueDifference" => Variant_::ValueDifference,
1441            "filterTransformation" => Variant_::FilterTransformation,
1442            "thresholdFilter" => Variant_::ThresholdFilter,
1443            "approximateFilter" => Variant_::ApproximateFilter,
1444            "dropNan" => Variant_::DropNan,
1445            "select1dArrayIndex" => Variant_::Select1dArrayIndex,
1446            "aggregateUnderRanges" => Variant_::AggregateUnderRanges,
1447            "filterByExpression" => Variant_::FilterByExpression,
1448            "scalarUdf" => Variant_::ScalarUdf,
1449            "enumToNumeric" => Variant_::EnumToNumeric,
1450            "refprop" => Variant_::Refprop,
1451            "extractFromStruct" => Variant_::ExtractFromStruct,
1452            "tagByIntervals" => Variant_::TagByIntervals,
1453            "filterByTag" => Variant_::FilterByTag,
1454            "selectTags" => Variant_::SelectTags,
1455            "toStartOfInterval" => Variant_::ToStartOfInterval,
1456            "phaseUnwrap" => Variant_::PhaseUnwrap,
1457            "aggregate" => Variant_::Aggregate,
1458            "rollingOperation" => Variant_::RollingOperation,
1459            "bitOperation" => Variant_::BitOperation,
1460            "channel" => Variant_::Channel,
1461            "offset" => Variant_::Offset,
1462            "scale" => Variant_::Scale,
1463            "arithmetic" => Variant_::Arithmetic,
1464            "unaryArithmetic" => Variant_::UnaryArithmetic,
1465            "binaryArithmetic" => Variant_::BinaryArithmetic,
1466            value => Variant_::Unknown(value.to_string().into_boxed_str()),
1467        };
1468        Ok(v)
1469    }
1470}
1471///An unknown variant of the NumericSeries union.
1472#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1473pub struct Unknown {
1474    type_: Box<str>,
1475    value: conjure_object::Any,
1476}
1477impl Unknown {
1478    /// Returns the unknown variant's type name.
1479    #[inline]
1480    pub fn type_(&self) -> &str {
1481        &self.type_
1482    }
1483}