Struct conjure_object::DoubleKey
source · [−]pub struct DoubleKey<T>(pub T);
Expand description
A wrapper type allowing f64
to be used as a key in collection types.
Conjure allows map<double, T>
and set<double>
, but Rust’s f64
type does not implement Eq
and Ord
,
preventing the direct translations of BTreeMap<f64, T>
and BTreeSet<f64>
from compiling. This wrapper type is
used to provide suitable trait implementations. The code generated by conjure-codegen
will use this type,
resulting in BTreeMap<DoubleKey<f64>, T>
and BTreeSet<DoubleKey<f64>>
.
All trait implementations delegate directly to the inner type, with the exception of the PartialEq
, Eq
,
PartialOrd
, and Ord
methods.
Tuple Fields
0: T
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for DoubleKey<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for DoubleKey<T> where
T: Deserialize<'de>,
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T> Ord for DoubleKey<T> where
T: AsDouble,
impl<T> Ord for DoubleKey<T> where
T: AsDouble,
sourceimpl<T> PartialOrd<DoubleKey<T>> for DoubleKey<T> where
T: AsDouble,
impl<T> PartialOrd<DoubleKey<T>> for DoubleKey<T> where
T: AsDouble,
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl<T: Copy> Copy for DoubleKey<T>
impl<T> Eq for DoubleKey<T> where
T: AsDouble,
Auto Trait Implementations
impl<T> RefUnwindSafe for DoubleKey<T> where
T: RefUnwindSafe,
impl<T> Send for DoubleKey<T> where
T: Send,
impl<T> Sync for DoubleKey<T> where
T: Sync,
impl<T> Unpin for DoubleKey<T> where
T: Unpin,
impl<T> UnwindSafe for DoubleKey<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more