pub struct HashableValue(pub Value);Expand description
A hashable wrapper around Value for use in hash-based indexes.
Value itself cannot implement Hash because it contains f64 (which has
NaN issues). This wrapper converts floats to their bit representation for
hashing, allowing values to be used as keys in hash maps and sets.
§Note on Float Equality
Two HashableValues containing f64 are considered equal if they have
identical bit representations. This means NaN == NaN (same bits) and
positive/negative zero are considered different.
Tuple Fields§
§0: ValueImplementations§
Trait Implementations§
Source§impl Clone for HashableValue
impl Clone for HashableValue
Source§fn clone(&self) -> HashableValue
fn clone(&self) -> HashableValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HashableValue
impl Debug for HashableValue
Source§impl From<HashableValue> for Value
impl From<HashableValue> for Value
Source§fn from(hv: HashableValue) -> Self
fn from(hv: HashableValue) -> Self
Converts to this type from the input type.
Source§impl From<Value> for HashableValue
impl From<Value> for HashableValue
Source§impl Hash for HashableValue
impl Hash for HashableValue
Source§impl PartialEq for HashableValue
impl PartialEq for HashableValue
impl Eq for HashableValue
Auto Trait Implementations§
impl Freeze for HashableValue
impl RefUnwindSafe for HashableValue
impl Send for HashableValue
impl Sync for HashableValue
impl Unpin for HashableValue
impl UnwindSafe for HashableValue
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.