#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct EnumBucket {
#[builder(default, map(key(type = i32), value(type = conjure_object::SafeLong)))]
#[serde(
rename = "histogram",
skip_serializing_if = "std::collections::BTreeMap::is_empty",
default
)]
histogram: std::collections::BTreeMap<i32, conjure_object::SafeLong>,
#[builder(custom(type = super::CompactEnumPoint, convert = Box::new))]
#[serde(rename = "firstPoint")]
first_point: Box<super::CompactEnumPoint>,
#[builder(
default,
custom(
type = impl
Into<Option<super::CompactEnumPoint>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "lastPoint", skip_serializing_if = "Option::is_none", default)]
last_point: Option<Box<super::CompactEnumPoint>>,
}
impl EnumBucket {
#[inline]
pub fn new(first_point: super::CompactEnumPoint) -> Self {
Self::builder().first_point(first_point).build()
}
#[inline]
pub fn histogram(
&self,
) -> &std::collections::BTreeMap<i32, conjure_object::SafeLong> {
&self.histogram
}
#[inline]
pub fn first_point(&self) -> &super::CompactEnumPoint {
&*self.first_point
}
#[inline]
pub fn last_point(&self) -> Option<&super::CompactEnumPoint> {
self.last_point.as_ref().map(|o| &**o)
}
}