nominal-api-conjure 0.1452.0

Conjure HTTP API bindings for the Nominal platform
Documentation
#![allow(deprecated)]
use std::fmt;
use std::str;
/// Physical constants referenceable by name.
/// The server resolves the symbol to its numeric value in SI units.
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
    conjure_object::log_safety::derive::LogSafe
)]
#[serde(crate = "conjure_object::serde")]
pub enum PhysicalConstant {
    /// Speed of light in vacuum, 299792458 m/s (exact).
    #[serde(rename = "SPEED_OF_LIGHT")]
    SpeedOfLight,
    /// Avogadro constant, 6.02214076e23 mol^-1 (exact).
    #[serde(rename = "AVOGADRO")]
    Avogadro,
    /// Boltzmann constant, 1.380649e-23 J/K (exact).
    #[serde(rename = "BOLTZMANN")]
    Boltzmann,
    /// Planck constant, 6.62607015e-34 J*s (exact).
    #[serde(rename = "PLANCK")]
    Planck,
    /// Elementary charge, 1.602176634e-19 C (exact).
    #[serde(rename = "ELEMENTARY_CHARGE")]
    ElementaryCharge,
    /// Molar gas constant, 8.31446261815324 J/(mol*K) (exact, Avogadro times Boltzmann).
    #[serde(rename = "GAS_CONSTANT")]
    GasConstant,
    /// Standard acceleration of gravity, 9.80665 m/s^2 (exact by convention).
    #[serde(rename = "STANDARD_GRAVITY")]
    StandardGravity,
    /// Standard atmosphere, 101325 Pa (exact by convention).
    #[serde(rename = "STANDARD_ATMOSPHERE")]
    StandardAtmosphere,
    /// Absolute zero expressed in degrees Celsius, -273.15 (exact).
    #[serde(rename = "ABSOLUTE_ZERO_CELSIUS")]
    AbsoluteZeroCelsius,
    /// Newtonian constant of gravitation, 6.67430e-11 m^3/(kg*s^2) (CODATA 2022, measured).
    #[serde(rename = "GRAVITATIONAL_CONSTANT")]
    GravitationalConstant,
    /// Stefan-Boltzmann constant, 5.670374419e-8 W/(m^2*K^4) (exact derived).
    #[serde(rename = "STEFAN_BOLTZMANN")]
    StefanBoltzmann,
    /// An unknown variant.
    #[serde(untagged)]
    Unknown(Unknown),
}
impl PhysicalConstant {
    /// Returns the string representation of the enum.
    #[inline]
    pub fn as_str(&self) -> &str {
        match self {
            PhysicalConstant::SpeedOfLight => "SPEED_OF_LIGHT",
            PhysicalConstant::Avogadro => "AVOGADRO",
            PhysicalConstant::Boltzmann => "BOLTZMANN",
            PhysicalConstant::Planck => "PLANCK",
            PhysicalConstant::ElementaryCharge => "ELEMENTARY_CHARGE",
            PhysicalConstant::GasConstant => "GAS_CONSTANT",
            PhysicalConstant::StandardGravity => "STANDARD_GRAVITY",
            PhysicalConstant::StandardAtmosphere => "STANDARD_ATMOSPHERE",
            PhysicalConstant::AbsoluteZeroCelsius => "ABSOLUTE_ZERO_CELSIUS",
            PhysicalConstant::GravitationalConstant => "GRAVITATIONAL_CONSTANT",
            PhysicalConstant::StefanBoltzmann => "STEFAN_BOLTZMANN",
            PhysicalConstant::Unknown(v) => &*v,
        }
    }
}
impl fmt::Display for PhysicalConstant {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt::Display::fmt(self.as_str(), fmt)
    }
}
impl conjure_object::Plain for PhysicalConstant {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        conjure_object::Plain::fmt(self.as_str(), fmt)
    }
}
impl str::FromStr for PhysicalConstant {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_str(
        v: &str,
    ) -> Result<PhysicalConstant, conjure_object::plain::ParseEnumError> {
        match v {
            "SPEED_OF_LIGHT" => Ok(PhysicalConstant::SpeedOfLight),
            "AVOGADRO" => Ok(PhysicalConstant::Avogadro),
            "BOLTZMANN" => Ok(PhysicalConstant::Boltzmann),
            "PLANCK" => Ok(PhysicalConstant::Planck),
            "ELEMENTARY_CHARGE" => Ok(PhysicalConstant::ElementaryCharge),
            "GAS_CONSTANT" => Ok(PhysicalConstant::GasConstant),
            "STANDARD_GRAVITY" => Ok(PhysicalConstant::StandardGravity),
            "STANDARD_ATMOSPHERE" => Ok(PhysicalConstant::StandardAtmosphere),
            "ABSOLUTE_ZERO_CELSIUS" => Ok(PhysicalConstant::AbsoluteZeroCelsius),
            "GRAVITATIONAL_CONSTANT" => Ok(PhysicalConstant::GravitationalConstant),
            "STEFAN_BOLTZMANN" => Ok(PhysicalConstant::StefanBoltzmann),
            v => v.parse().map(|v| PhysicalConstant::Unknown(Unknown(v))),
        }
    }
}
impl conjure_object::FromPlain for PhysicalConstant {
    type Err = conjure_object::plain::ParseEnumError;
    #[inline]
    fn from_plain(
        v: &str,
    ) -> Result<PhysicalConstant, conjure_object::plain::ParseEnumError> {
        v.parse()
    }
}
///An unknown variant of the PhysicalConstant enum.
#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    conjure_object::serde::Deserialize,
    conjure_object::serde::Serialize,
    conjure_object::log_safety::derive::LogSafe,
)]
#[serde(crate = "conjure_object::serde", transparent)]
pub struct Unknown(conjure_object::private::Variant);
impl std::ops::Deref for Unknown {
    type Target = str;
    #[inline]
    fn deref(&self) -> &str {
        &self.0
    }
}
impl fmt::Display for Unknown {
    #[inline]
    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
        fmt::Display::fmt(&self.0, fmt)
    }
}