Trait typenum::type_operators::Cmp
source · 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);
Required Associated Types§
Object Safety§
This trait is not object safe.
Implementors§
source§impl<Nl: Unsigned + NonZero, Nr: Cmp<Nl> + Unsigned + NonZero> Cmp<NInt<Nr>> for NInt<Nl>
impl<Nl: Unsigned + NonZero, Nr: Cmp<Nl> + Unsigned + NonZero> Cmp<NInt<Nr>> for NInt<Nl>
-X <==> -Y
source§impl<Pl: Cmp<Pr> + Unsigned + NonZero, Pr: Unsigned + NonZero> Cmp<PInt<Pr>> for PInt<Pl>
impl<Pl: Cmp<Pr> + Unsigned + NonZero, Pr: Unsigned + NonZero> Cmp<PInt<Pr>> for PInt<Pl>
X <==> Y
source§impl<Ul, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B0>
impl<Ul, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B0>
UInt<Ul, B0>
cmp with UInt<Ur, B0>
: SoFar
is Equal
source§impl<Ul, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B1>
impl<Ul, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B1>
UInt<Ul, B1>
cmp with UInt<Ur, B0>
: SoFar
is Greater