Skip to main content

nominal_api/conjure/objects/scout/compute/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(key(type = super::VariableName), value(type = super::NumericSeries))
16    )]
17    #[serde(
18        rename = "inputs",
19        skip_serializing_if = "std::collections::BTreeMap::is_empty",
20        default
21    )]
22    inputs: std::collections::BTreeMap<super::VariableName, super::NumericSeries>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::NumericHistogramBucketStrategy>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "bucketStrategy", skip_serializing_if = "Option::is_none", default)]
32    bucket_strategy: Option<Box<super::NumericHistogramBucketStrategy>>,
33}
34impl NumericHistogramNode {
35    /// Constructs a new instance of the type.
36    #[inline]
37    pub fn new() -> Self {
38        Self::builder().build()
39    }
40    #[inline]
41    pub fn inputs(
42        &self,
43    ) -> &std::collections::BTreeMap<super::VariableName, super::NumericSeries> {
44        &self.inputs
45    }
46    #[inline]
47    pub fn bucket_strategy(&self) -> Option<&super::NumericHistogramBucketStrategy> {
48        self.bucket_strategy.as_ref().map(|o| &**o)
49    }
50}