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