1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// A user-defined numeric aggregation. The aggregation builder controls grouping/windowing.
/// Supported Rust entrypoints accept grouped value vectors, optionally with leading sample timestamps,
/// and return either one numeric value or timestamped numeric point(s), e.g.
/// `fn rms(values: Vec<f64>) -> f64`,
/// `fn energy(timestamp_ns: Vec<i64>, values: Vec<f64>) -> f64`,
/// `fn first(timestamp_ns: Vec<i64>, values: Vec<f64>) -> (i64, f64)`, or
/// `fn passthrough(timestamp_ns: Vec<i64>, values: Vec<f64>) -> Vec<(i64, f64)>`.
#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct NumericAggregationUdf {
#[builder(custom(type = super::UdfSource, convert = Box::new))]
#[serde(rename = "source")]
source: Box<super::UdfSource>,
}
impl NumericAggregationUdf {
/// Constructs a new instance of the type.
#[inline]
pub fn new(source: super::UdfSource) -> Self {
Self::builder().source(source).build()
}
#[inline]
pub fn source(&self) -> &super::UdfSource {
&*self.source
}
}