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

The result of the comparison. It should only ever be one of Greater, Less, or Equal.

Implementors

0 == 0

Zero == Zero

-X <==> -Y

X > - Y

-X < Y

X <==> Y

0 > -X

0 < X

-X < 0

X > 0

Zero < Nonzero

Nonzero > Zero

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

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

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

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