Struct bevy_utils::FloatOrd
source · pub struct FloatOrd(pub f32);
Expand description
A wrapper for floats that implements Ord
, Eq
, and Hash
traits.
This is a work around for the fact that the IEEE 754-2008 standard,
implemented by Rust’s f32
type,
doesn’t define an ordering for NaN
,
and NaN
is not considered equal to any other NaN
.
Wrapping a float with FloatOrd
breaks conformance with the standard
by sorting NaN
as less than all other numbers and equal to any other NaN
.
Tuple Fields§
§0: f32
Trait Implementations§
source§impl Ord for FloatOrd
impl Ord for FloatOrd
source§impl PartialEq for FloatOrd
impl PartialEq for FloatOrd
source§impl PartialOrd for FloatOrd
impl PartialOrd for FloatOrd
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for FloatOrd
impl Eq for FloatOrd
Auto Trait Implementations§
impl RefUnwindSafe for FloatOrd
impl Send for FloatOrd
impl Sync for FloatOrd
impl Unpin for FloatOrd
impl UnwindSafe for FloatOrd
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.