Skip to main content

nominal_api/conjure/objects/scout/compute/api/
range_aggregation.rs

1/// An aggregation value representing combined aggregation metrics for data over a range.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith,
8    Copy
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct RangeAggregation {
15    #[serde(rename = "average")]
16    #[derive_with(with = conjure_object::private::DoubleWrapper)]
17    average: f64,
18    #[serde(rename = "min")]
19    #[derive_with(with = conjure_object::private::DoubleWrapper)]
20    min: f64,
21    #[serde(rename = "max")]
22    #[derive_with(with = conjure_object::private::DoubleWrapper)]
23    max: f64,
24    #[serde(rename = "standardDeviation")]
25    #[derive_with(with = conjure_object::private::DoubleWrapper)]
26    standard_deviation: f64,
27    #[serde(rename = "count")]
28    #[derive_with(with = conjure_object::private::DoubleWrapper)]
29    count: f64,
30    #[serde(rename = "sum")]
31    #[derive_with(with = conjure_object::private::DoubleWrapper)]
32    sum: f64,
33    #[builder(default, into)]
34    #[serde(rename = "rootMeanSquare", skip_serializing_if = "Option::is_none", default)]
35    #[derive_with(with = conjure_object::private::DoubleWrapper)]
36    root_mean_square: Option<f64>,
37}
38impl RangeAggregation {
39    #[inline]
40    pub fn average(&self) -> f64 {
41        self.average
42    }
43    #[inline]
44    pub fn min(&self) -> f64 {
45        self.min
46    }
47    #[inline]
48    pub fn max(&self) -> f64 {
49        self.max
50    }
51    #[inline]
52    pub fn standard_deviation(&self) -> f64 {
53        self.standard_deviation
54    }
55    #[inline]
56    pub fn count(&self) -> f64 {
57        self.count
58    }
59    #[inline]
60    pub fn sum(&self) -> f64 {
61        self.sum
62    }
63    #[inline]
64    pub fn root_mean_square(&self) -> Option<f64> {
65        self.root_mean_square.as_ref().map(|o| *o)
66    }
67}