Trait typenum::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 std::cmp::Ord::cmp but for types.

Example

use typenum::{Cmp, Ord, Greater, Less, Equal};
use typenum::consts::{N3, P2, P5};

assert_eq!(<P2 as Cmp<N3>>::Output::to_ordering(), Greater::to_ordering());
assert_eq!(<P2 as Cmp<P2>>::Output::to_ordering(), Equal::to_ordering());
assert_eq!(<P2 as Cmp<P5>>::Output::to_ordering(), Less::to_ordering());

Associated Types

type Output

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

Implementors