Skip to main content

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

1/// A bucket in an enum histogram representing all the counts
2/// for a specific enumerated value, across all input series.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct EnumHistogramBucket {
18    #[builder(into)]
19    #[serde(rename = "value")]
20    value: String,
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}
35impl EnumHistogramBucket {
36    /// Constructs a new instance of the type.
37    #[inline]
38    pub fn new(value: impl Into<String>) -> Self {
39        Self::builder().value(value).build()
40    }
41    /// The value of the enum as a string
42    #[inline]
43    pub fn value(&self) -> &str {
44        &*self.value
45    }
46    #[inline]
47    pub fn counts_by_channel(
48        &self,
49    ) -> &std::collections::BTreeMap<super::VariableName, super::HistogramChannelCount> {
50        &self.counts_by_channel
51    }
52}