nominal_api/conjure/objects/scout/compute/api/
numeric_histogram_bucket.rs1#[derive(
4 Debug,
5 Clone,
6 conjure_object::serde::Serialize,
7 conjure_object::serde::Deserialize,
8 conjure_object::private::DeriveWith
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 NumericHistogramBucket {
15 #[serde(rename = "lowerBound")]
16 #[derive_with(with = conjure_object::private::DoubleWrapper)]
17 lower_bound: f64,
18 #[serde(rename = "upperBound")]
19 #[derive_with(with = conjure_object::private::DoubleWrapper)]
20 upper_bound: f64,
21 #[builder(
22 default,
23 map(key(type = super::VariableName), value(type = super::HistogramChannelCount))
24 )]
25 #[serde(
26 rename = "countsByChannel",
27 skip_serializing_if = "std::collections::BTreeMap::is_empty",
28 default
29 )]
30 counts_by_channel: std::collections::BTreeMap<
31 super::VariableName,
32 super::HistogramChannelCount,
33 >,
34 #[builder(
35 default,
36 map(key(type = super::VariableName), value(type = super::HistogramChannelCount))
37 )]
38 #[serde(
39 rename = "buckets",
40 skip_serializing_if = "std::collections::BTreeMap::is_empty",
41 default
42 )]
43 buckets: std::collections::BTreeMap<
44 super::VariableName,
45 super::HistogramChannelCount,
46 >,
47}
48impl NumericHistogramBucket {
49 #[inline]
51 pub fn new(lower_bound: f64, upper_bound: f64) -> Self {
52 Self::builder().lower_bound(lower_bound).upper_bound(upper_bound).build()
53 }
54 #[inline]
56 pub fn lower_bound(&self) -> f64 {
57 self.lower_bound
58 }
59 #[inline]
61 pub fn upper_bound(&self) -> f64 {
62 self.upper_bound
63 }
64 #[inline]
65 pub fn counts_by_channel(
66 &self,
67 ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
68 &self.counts_by_channel
69 }
70 #[deprecated(note = "Use countsByChannel instead")]
71 #[inline]
72 pub fn buckets(
73 &self,
74 ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
75 &self.buckets
76 }
77}