Trait tet_libp2p::multihash::typenum::Cmp[]

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.

Loading content...

Implementors

impl Cmp<B0> for B0

type Output = Equal

impl Cmp<B0> for B1

type Output = Greater

impl Cmp<B1> for B0

type Output = Less

impl Cmp<B1> for B1

type Output = Equal

impl Cmp<UTerm> for UTerm

Zero == Zero

type Output = Equal

impl Cmp<Z0> for Z0

0 == 0

type Output = Equal

impl<Nl, Nr> Cmp<NInt<Nr>> for NInt<Nl> where
    Nl: NonZero + Unsigned,
    Nr: NonZero + Unsigned + Cmp<Nl>, 

-X <==> -Y

type Output = <Nr as Cmp<Nl>>::Output

impl<P, N> Cmp<NInt<N>> for PInt<P> where
    N: NonZero + Unsigned,
    P: NonZero + Unsigned

X > - Y

type Output = Greater

impl<P, N> Cmp<PInt<P>> for NInt<N> where
    N: NonZero + Unsigned,
    P: NonZero + Unsigned

-X < Y

type Output = Less

impl<Pl, Pr> Cmp<PInt<Pr>> for PInt<Pl> where
    Pl: NonZero + Unsigned + Cmp<Pr>,
    Pr: NonZero + Unsigned

X <==> Y

type Output = <Pl as Cmp<Pr>>::Output

impl<U> Cmp<NInt<U>> for Z0 where
    U: NonZero + Unsigned

0 > -X

type Output = Greater

impl<U> Cmp<PInt<U>> for Z0 where
    U: NonZero + Unsigned

0 < X

type Output = Less

impl<U> Cmp<Z0> for NInt<U> where
    U: NonZero + Unsigned

-X < 0

type Output = Less

impl<U> Cmp<Z0> for PInt<U> where
    U: NonZero + Unsigned

X > 0

type Output = Greater

impl<U, B> Cmp<UInt<U, B>> for UTerm where
    B: Bit,
    U: Unsigned

Zero < Nonzero

type Output = Less

impl<U, B> Cmp<UTerm> for UInt<U, B> where
    B: Bit,
    U: Unsigned

Nonzero > Zero

type Output = Greater

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

type Output = <Ul as PrivateCmp<Ur, Equal>>::Output

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

type Output = <Ul as PrivateCmp<Ur, Greater>>::Output

impl<Ul, Ur> Cmp<UInt<Ur, B1>> for UInt<Ul, B0> where
    Ul: Unsigned + PrivateCmp<Ur, Less>,
    Ur: Unsigned

UInt<Ul, B0> cmp with UInt<Ur, B1>: SoFar is Less

type Output = <Ul as PrivateCmp<Ur, Less>>::Output

impl<Ul, Ur> Cmp<UInt<Ur, B1>> for UInt<Ul, B1> where
    Ul: Unsigned + PrivateCmp<Ur, Equal>,
    Ur: Unsigned

UInt<Ul, B1> cmp with UInt<Ur, B1>: SoFar is Equal

type Output = <Ul as PrivateCmp<Ur, Equal>>::Output

Loading content...