real: add serialization bounds to the Real trait

This commit is contained in:
2022-07-29 13:22:03 -07:00
parent 95ffb73fe3
commit 95213e61be

View File

@@ -20,11 +20,19 @@ pub trait ToFloat {
}
}
#[cfg(feature = "fmt")]
pub trait RealFeatures: fmt::LowerExp + fmt::Display + fmt::Debug {}
#[cfg(not(feature = "fmt"))]
#[cfg(all(not(feature = "fmt"), not(feature = "serde")))]
pub trait RealFeatures {}
#[cfg(all(not(feature = "fmt"), feature = "serde"))]
pub trait RealFeatures: Serialize + for<'a> Deserialize<'a> {}
#[cfg(all(feature = "fmt", not(feature = "serde")))]
pub trait RealFeatures: fmt::LowerExp + fmt::Display + fmt::Debug {}
#[cfg(all(feature = "fmt", feature = "serde"))]
pub trait RealFeatures: fmt::LowerExp + fmt::Display + fmt::Debug + Serialize + for<'a> Deserialize<'a> {}
/// This exists to allow configuration over # of bits (f32 v.s. f64) as well as
/// constraints.
pub trait Real: