pub struct CmpWrapper<T>(pub T);
This is supported on crate feature cmp
only.
Expand description
A wrapper type for std types, which defines const_eq
and const_cmp
methods for them.
This is what coerce_to_cmp
and the comparison macros convert standard library types into.
use konst::{
polymorphism::CmpWrapper,
coerce_to_cmp,
};
use std::cmp::Ordering;
{
let foo: CmpWrapper<u32> = coerce_to_cmp!(10u32);
assert!( foo.const_eq(&10));
assert!(!foo.const_eq(&20));
assert_eq!(foo.const_cmp(&5), Ordering::Greater);
assert_eq!(foo.const_cmp(&10), Ordering::Equal);
assert_eq!(foo.const_cmp(&15), Ordering::Less);
}
{
let bar = CmpWrapper(Ordering::Equal);
assert!( bar.const_eq(&Ordering::Equal));
assert!(!bar.const_eq(&Ordering::Less));
assert_eq!(bar.const_cmp(&Ordering::Less), Ordering::Greater);
assert_eq!(bar.const_cmp(&Ordering::Equal), Ordering::Equal);
assert_eq!(bar.const_cmp(&Ordering::Greater), Ordering::Less);
}
For constructing from a reference to an array.
With slices you can do CmpWrapper(slice)
as well.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Compares self
and other
for equality.
Compares self
and other
for ordering.
Performs copy-assignment from source
. Read more
What kind of type this is, this can be one of: Read more
The type after dereferencing,
implemented as type This = Self;
for all non-reference types Read more
Formats the value using the given formatter. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.