Trait typenum::type_operators::Cmp [−][src]
pub trait Cmp<Rhs = Self> { type Output; }
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
type Output
The result of the comparison. It should only ever be one of Greater
, Less
, or Equal
.
Implementors
impl Cmp<B0> for B0 type Output = Equal;
impl Cmp<B1> for B0 type Output = Less;
impl Cmp<B0> for B1 type Output = Greater;
impl Cmp<B1> for B1 type Output = Equal;
impl Cmp<UTerm> for UTerm type Output = Equal;
impl<U: Unsigned, B: Bit> Cmp<UTerm> for UInt<U, B> type Output = Greater;
impl<U: Unsigned, B: Bit> Cmp<UInt<U, B>> for UTerm type Output = Less;
impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B0> where
Ul: PrivateCmp<Ur, Equal>, type Output = PrivateCmpOut<Ul, Ur, Equal>;impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B1>> for UInt<Ul, B1> where
Ul: PrivateCmp<Ur, Equal>, type Output = PrivateCmpOut<Ul, Ur, Equal>;impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B1>> for UInt<Ul, B0> where
Ul: PrivateCmp<Ur, Less>, type Output = PrivateCmpOut<Ul, Ur, Less>;impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B1> where
Ul: PrivateCmp<Ur, Greater>, type Output = PrivateCmpOut<Ul, Ur, Greater>;impl Cmp<Z0> for Z0 type Output = Equal;
impl<U: Unsigned + NonZero> Cmp<NInt<U>> for Z0 type Output = Greater;
impl<U: Unsigned + NonZero> Cmp<PInt<U>> for Z0 type Output = Less;
impl<U: Unsigned + NonZero> Cmp<Z0> for PInt<U> type Output = Greater;
impl<U: Unsigned + NonZero> Cmp<Z0> for NInt<U> type Output = Less;
impl<P: Unsigned + NonZero, N: Unsigned + NonZero> Cmp<PInt<P>> for NInt<N> type Output = Less;
impl<P: Unsigned + NonZero, N: Unsigned + NonZero> Cmp<NInt<N>> for PInt<P> type Output = Greater;
impl<Pl: Cmp<Pr> + Unsigned + NonZero, Pr: Unsigned + NonZero> Cmp<PInt<Pr>> for PInt<Pl> type Output = <Pl as Cmp<Pr>>::Output;
impl<Nl: Unsigned + NonZero, Nr: Cmp<Nl> + Unsigned + NonZero> Cmp<NInt<Nr>> for NInt<Nl> type Output = <Nr as Cmp<Nl>>::Output;