Skip to main content

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