Struct ord_subset::OrdVar
[−]
[src]
pub struct OrdVar<T: PartialOrd + PartialEq>(_);
Wrapper to signal that the contained variables have a total order. It's illegal to compare two OrdVar
s that are not ordered.
For this reason, it's unsafe to create OrdVar
s without checking. Checked constructors are available for OrdSubset
types.
Panics
Panics when a.partial_cmp(b)
returns None
for two values a
,b
.
Methods
impl<T: PartialOrd + PartialEq> OrdVar<T>
[src]
fn new(data: T) -> OrdVar<T> where
T: Debug + OrdSubset,
[src]
T: Debug + OrdSubset,
Construct an OrdVar
out of the argument.
Panics
Panics if the argument is outside of the total order.
fn new_checked(data: T) -> Option<OrdVar<T>> where
T: OrdSubset,
[src]
T: OrdSubset,
Constructs an Option<OrdVar>
out of the argument. Returns None if the argument is outside the total order.
fn new_unchecked(data: T) -> OrdVar<T>
[src]
Constructs an OrdVar
without validity check. Incorrectly constructed OrdVar
s may panic on calls to .cmp()
.
The comparison operators (>
, >=
, =
, !=
, <
, <=
) will not panic but may result in surprising behaviour.
fn into_inner(self) -> T
[src]
Trait Implementations
impl<T: PartialEq + PartialOrd + PartialEq> PartialEq for OrdVar<T>
[src]
fn eq(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests for !=
.
impl<T: PartialOrd + PartialOrd + PartialEq> PartialOrd for OrdVar<T>
[src]
fn partial_cmp(&self, __arg_0: &OrdVar<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &OrdVar<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Clone + PartialOrd + PartialEq> Clone for OrdVar<T>
[src]
fn clone(&self) -> OrdVar<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy + PartialOrd + PartialEq> Copy for OrdVar<T>
[src]
impl<T: Debug + PartialOrd + PartialEq> Debug for OrdVar<T>
[src]
impl<T: Hash + PartialOrd + PartialEq> Hash for OrdVar<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: PartialOrd + PartialEq> Eq for OrdVar<T>
[src]
impl<T: PartialOrd + PartialEq> Ord for OrdVar<T>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more