We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e80f42 commit a90797dCopy full SHA for a90797d
1 file changed
src/lib.rs
@@ -1261,6 +1261,18 @@ impl<T: FloatCore> NotNan<T> {
1261
}
1262
1263
1264
+impl NotNan<f32> {
1265
+ /// Create a `NotNan` value possibly at compile-time.
1266
+ ///
1267
+ /// Returns `Err` if `val` is NaN
1268
+ pub const fn new_const(val: f32) -> Result<Self, FloatIsNan> {
1269
+ match val {
1270
+ ref val if val.is_nan() => Err(FloatIsNan),
1271
+ val => Ok(NotNan(val)),
1272
+ }
1273
1274
+}
1275
+
1276
impl<T> NotNan<T> {
1277
/// Get the value out.
1278
#[inline]
0 commit comments