#[repr(transparent)]pub struct NativeValue<T>(pub T);
Expand description
NativeValue serves as a wrapper type to allow us to implement Hash and Eq on all primitive types.
Rust does not define Hash/Eq for any of the float types due to the presence of NaN and +/- 0. We don’t care about storing multiple NaNs or zeros in our dictionaries, so we define simple bit-wise Hash/Eq for the Value-wrapped versions of these types.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T: Clone> Clone for NativeValue<T>
impl<T: Clone> Clone for NativeValue<T>
Source§fn clone(&self) -> NativeValue<T>
fn clone(&self) -> NativeValue<T>
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<T: Debug> Debug for NativeValue<T>
impl<T: Debug> Debug for NativeValue<T>
Source§impl Hash for NativeValue<f16>
impl Hash for NativeValue<f16>
Source§impl Hash for NativeValue<f32>
impl Hash for NativeValue<f32>
Source§impl Hash for NativeValue<f64>
impl Hash for NativeValue<f64>
Source§impl Hash for NativeValue<i16>
impl Hash for NativeValue<i16>
Source§impl Hash for NativeValue<i32>
impl Hash for NativeValue<i32>
Source§impl Hash for NativeValue<i64>
impl Hash for NativeValue<i64>
Source§impl Hash for NativeValue<i8>
impl Hash for NativeValue<i8>
Source§impl Hash for NativeValue<u16>
impl Hash for NativeValue<u16>
Source§impl Hash for NativeValue<u32>
impl Hash for NativeValue<u32>
Source§impl Hash for NativeValue<u64>
impl Hash for NativeValue<u64>
Source§impl Hash for NativeValue<u8>
impl Hash for NativeValue<u8>
Source§impl<T: NativePType> PartialEq for NativeValue<T>
impl<T: NativePType> PartialEq for NativeValue<T>
impl<T: Copy> Copy for NativeValue<T>
impl<T: NativePType> Eq for NativeValue<T>
Auto Trait Implementations§
impl<T> Freeze for NativeValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for NativeValue<T>where
T: RefUnwindSafe,
impl<T> Send for NativeValue<T>where
T: Send,
impl<T> Sync for NativeValue<T>where
T: Sync,
impl<T> Unpin for NativeValue<T>where
T: Unpin,
impl<T> UnwindSafe for NativeValue<T>where
T: UnwindSafe,
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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more