nominal-api 0.1239.0

API bindings for the Nominal platform
Documentation
/// Maps a continuous numeric series to a discrete enum series using the specified value ranges.
#[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 ValueMapSeries {
    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::NumericSeries>,
    #[builder(default, list(item(type = super::RangeMap)))]
    #[serde(rename = "mapping", skip_serializing_if = "Vec::is_empty", default)]
    mapping: Vec<super::RangeMap>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::StringConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "default", skip_serializing_if = "Option::is_none", default)]
    default: Option<Box<super::StringConstant>>,
}
impl ValueMapSeries {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::NumericSeries) -> Self {
        Self::builder().input(input).build()
    }
    /// The input series to map to an enumerated series
    #[inline]
    pub fn input(&self) -> &super::NumericSeries {
        &*self.input
    }
    /// The output of the first capturing range will be used. Ranges are start inclusive, end exclusive, must not overlap,
    /// and increasing from lowest to highest. Ranges can be open ended to the edge of the next or prior range.
    /// The first range can be open ended to negative infinity, and the last range can be open ended to positive infinity.
    #[inline]
    pub fn mapping(&self) -> &[super::RangeMap] {
        &*self.mapping
    }
    /// The default value if not captured by any range. If not specified, points will be filtered.
    #[inline]
    pub fn default(&self) -> Option<&super::StringConstant> {
        self.default.as_ref().map(|o| &**o)
    }
}