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