Skip to main content

nominal_api/conjure/objects/scout/compute/resolved/api/
numeric_histogram_node.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct NumericHistogramNode {
13    #[builder(
14        default,
15        map(
16            key(type = super::super::super::api::VariableName),
17            value(type = super::NumericSeriesNode)
18        )
19    )]
20    #[serde(
21        rename = "inputs",
22        skip_serializing_if = "std::collections::BTreeMap::is_empty",
23        default
24    )]
25    inputs: std::collections::BTreeMap<
26        super::super::super::api::VariableName,
27        super::NumericSeriesNode,
28    >,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::NumericHistogramBucketStrategy>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(rename = "bucketStrategy", skip_serializing_if = "Option::is_none", default)]
38    bucket_strategy: Option<Box<super::NumericHistogramBucketStrategy>>,
39}
40impl NumericHistogramNode {
41    /// Constructs a new instance of the type.
42    #[inline]
43    pub fn new() -> Self {
44        Self::builder().build()
45    }
46    #[inline]
47    pub fn inputs(
48        &self,
49    ) -> &std::collections::BTreeMap<
50        super::super::super::api::VariableName,
51        super::NumericSeriesNode,
52    > {
53        &self.inputs
54    }
55    #[inline]
56    pub fn bucket_strategy(&self) -> Option<&super::NumericHistogramBucketStrategy> {
57        self.bucket_strategy.as_ref().map(|o| &**o)
58    }
59}