nominal-api 0.1239.0

API bindings for the Nominal platform
Documentation
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct NumericBucket {
    #[builder(default, into)]
    #[serde(rename = "min", skip_serializing_if = "Option::is_none", default)]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    min: Option<f64>,
    #[builder(default, into)]
    #[serde(rename = "max", skip_serializing_if = "Option::is_none", default)]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    max: Option<f64>,
    #[builder(default, into)]
    #[serde(rename = "mean", skip_serializing_if = "Option::is_none", default)]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    mean: Option<f64>,
    #[builder(default, into)]
    #[serde(rename = "count", skip_serializing_if = "Option::is_none", default)]
    count: Option<conjure_object::SafeLong>,
    #[builder(default, into)]
    #[serde(rename = "variance", skip_serializing_if = "Option::is_none", default)]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    variance: Option<f64>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::NumericPoint>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "firstPoint", skip_serializing_if = "Option::is_none", default)]
    first_point: Option<Box<super::NumericPoint>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::NumericPoint>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "lastPoint", skip_serializing_if = "Option::is_none", default)]
    last_point: Option<Box<super::NumericPoint>>,
}
impl NumericBucket {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new() -> Self {
        Self::builder().build()
    }
    #[inline]
    pub fn min(&self) -> Option<f64> {
        self.min.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn max(&self) -> Option<f64> {
        self.max.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn mean(&self) -> Option<f64> {
        self.mean.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn count(&self) -> Option<conjure_object::SafeLong> {
        self.count.as_ref().map(|o| *o)
    }
    /// The population variance of the bucket. If the bucket has only one value, this will be 0.
    #[inline]
    pub fn variance(&self) -> Option<f64> {
        self.variance.as_ref().map(|o| *o)
    }
    #[inline]
    pub fn first_point(&self) -> Option<&super::NumericPoint> {
        self.first_point.as_ref().map(|o| &**o)
    }
    /// Will be empty if the bucket only has a single point.
    #[inline]
    pub fn last_point(&self) -> Option<&super::NumericPoint> {
        self.last_point.as_ref().map(|o| &**o)
    }
}