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