Skip to content

Commit 9a241dc

Browse files
authored
Add Zero impl for OrderedFloat
Useful for the pathfinding crate
1 parent 90f4ca8 commit 9a241dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ impl<T: Float> Neg for OrderedFloat<T> {
195195
}
196196
}
197197

198+
impl<T: Float> Zero for OrderedFloat<T> {
199+
fn zero() -> Self { OrderedFloat(T::zero()) }
200+
201+
fn is_zero(&self) -> bool { self.0.is_zero() }
202+
}
203+
198204
/// A wrapper around Floats providing an implementation of Ord and Hash.
199205
///
200206
/// A NaN value cannot be stored in this type.

0 commit comments

Comments
 (0)