nominal-api 0.1239.0

API bindings for the Nominal platform
Documentation
/// Maps an enumerated series to a numeric series by mapping each string value to a double.
#[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 EnumToNumericSeries {
    #[builder(custom(type = super::EnumSeries, convert = Box::new))]
    #[serde(rename = "input")]
    input: Box<super::EnumSeries>,
    #[builder(
        default,
        map(key(type = String, into), value(type = super::DoubleConstant))
    )]
    #[serde(
        rename = "mapping",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    mapping: std::collections::BTreeMap<String, super::DoubleConstant>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::DoubleConstant>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "defaultValue", skip_serializing_if = "Option::is_none", default)]
    default_value: Option<Box<super::DoubleConstant>>,
}
impl EnumToNumericSeries {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(input: super::EnumSeries) -> Self {
        Self::builder().input(input).build()
    }
    #[inline]
    pub fn input(&self) -> &super::EnumSeries {
        &*self.input
    }
    /// The mapping from enum values to doubles.
    #[inline]
    pub fn mapping(&self) -> &std::collections::BTreeMap<String, super::DoubleConstant> {
        &self.mapping
    }
    /// The value to use for enum values not present in the mapping. If not specified, points with unmapped
    /// enum values will be dropped.
    #[inline]
    pub fn default_value(&self) -> Option<&super::DoubleConstant> {
        self.default_value.as_ref().map(|o| &**o)
    }
}