pub trait Cmp<Rhs = Self> {
type Output;
}
Expand description
A type operator for comparing Self
and Rhs
. It provides a similar functionality to
the function
core::cmp::Ord::cmp
but for types.
Example
use typenum::{Cmp, Ord, N3, P2, P5};
use std::cmp::Ordering;
assert_eq!(<P2 as Cmp<N3>>::Output::to_ordering(), Ordering::Greater);
assert_eq!(<P2 as Cmp<P2>>::Output::to_ordering(), Ordering::Equal);
assert_eq!(<P2 as Cmp<P5>>::Output::to_ordering(), Ordering::Less);
Associated Types
Implementors
sourceimpl<Nl, Nr> Cmp<NInt<Nr>> for NInt<Nl> where
Nl: Unsigned + NonZero,
Nr: Cmp<Nl> + Unsigned + NonZero,
impl<Nl, Nr> Cmp<NInt<Nr>> for NInt<Nl> where
Nl: Unsigned + NonZero,
Nr: Cmp<Nl> + Unsigned + NonZero,
-X <==> -Y
sourceimpl<P, N> Cmp<NInt<N>> for PInt<P> where
P: Unsigned + NonZero,
N: Unsigned + NonZero,
impl<P, N> Cmp<NInt<N>> for PInt<P> where
P: Unsigned + NonZero,
N: Unsigned + NonZero,
X > - Y
sourceimpl<P, N> Cmp<PInt<P>> for NInt<N> where
P: Unsigned + NonZero,
N: Unsigned + NonZero,
impl<P, N> Cmp<PInt<P>> for NInt<N> where
P: Unsigned + NonZero,
N: Unsigned + NonZero,
-X < Y
sourceimpl<Pl, Pr> Cmp<PInt<Pr>> for PInt<Pl> where
Pl: Cmp<Pr> + Unsigned + NonZero,
Pr: Unsigned + NonZero,
impl<Pl, Pr> Cmp<PInt<Pr>> for PInt<Pl> where
Pl: Cmp<Pr> + Unsigned + NonZero,
Pr: Unsigned + NonZero,
X <==> Y
sourceimpl<Ul, Ur> Cmp<UInt<Ur, B0>> for UInt<Ul, B0> where
Ul: Unsigned + PrivateCmp<Ur, Equal>,
Ur: Unsigned,
impl<Ul, Ur> Cmp<UInt<Ur, B0>> for UInt<Ul, B0> where
Ul: Unsigned + PrivateCmp<Ur, Equal>,
Ur: Unsigned,
UInt<Ul, B0>
cmp with UInt<Ur, B0>
: SoFar
is Equal
sourceimpl<Ul, Ur> Cmp<UInt<Ur, B0>> for UInt<Ul, B1> where
Ul: Unsigned + PrivateCmp<Ur, Greater>,
Ur: Unsigned,
impl<Ul, Ur> Cmp<UInt<Ur, B0>> for UInt<Ul, B1> where
Ul: Unsigned + PrivateCmp<Ur, Greater>,
Ur: Unsigned,
UInt<Ul, B1>
cmp with UInt<Ur, B0>
: SoFar
is Greater