nominal-api-conjure 0.1443.0

Conjure HTTP API bindings for the Nominal platform
Documentation
/// A double resolved from a DoubleConstant, carrying the constant's unit when one is known.
/// Literals and variables resolve without a unit; engineering constants always carry their SI unit.
/// Unit computation reads this wherever a resolved double appears, so units are never opt-in per node.
#[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 ResolvedDouble {
    #[serde(rename = "value")]
    #[derive_with(with = conjure_object::private::DoubleWrapper)]
    value: f64,
    #[builder(default, into)]
    #[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
    unit: Option<super::super::super::super::units::api::UnitSymbol>,
}
impl ResolvedDouble {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(value: f64) -> Self {
        Self::builder().value(value).build()
    }
    #[inline]
    pub fn value(&self) -> f64 {
        self.value
    }
    #[inline]
    pub fn unit(&self) -> Option<&super::super::super::super::units::api::UnitSymbol> {
        self.unit.as_ref().map(|o| &*o)
    }
}