feat: early interface with Python

This commit is contained in:
2025-03-13 15:38:51 -04:00
parent afe5eae96b
commit 96495b2a85
22 changed files with 623 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
use snafu::Snafu;
#[derive(Debug, Clone, derive_more::Into)]
pub struct FiniteF64(f64);
#[derive(Debug, Snafu)]
#[snafu(display("{value:?} is not finite"))]
pub struct NotFinite {
value: f64,
}
impl TryFrom<f64> for FiniteF64 {
type Error = NotFinite;
fn try_from(value: f64) -> Result<Self, Self::Error> {
if value.is_finite() {
Ok(Self(value))
} else {
Err(NotFinite { value })
}
}
}