# [−] [src] Trait typenum::type_operators::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` [src]

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

Loading content...

## Implementors

### `impl Cmp<B0> for B0` [src]

#### `type Output = Equal`

#### `fn compare<P: InternalMarker>(&self, _: &B0) -> Self::Output` [src]

### `impl Cmp<B0> for B1` [src]

#### `type Output = Greater`

#### `fn compare<P: InternalMarker>(&self, _: &B0) -> Self::Output` [src]

### `impl Cmp<B1> for B0` [src]

#### `type Output = Less`

#### `fn compare<P: InternalMarker>(&self, _: &B1) -> Self::Output` [src]

### `impl Cmp<B1> for B1` [src]

#### `type Output = Equal`

#### `fn compare<P: InternalMarker>(&self, _: &B1) -> Self::Output` [src]

### `impl Cmp<Z0> for Z0` [src]

0 == 0

#### `type Output = Equal`

#### `fn compare<IM: InternalMarker>(&self, _: &Z0) -> Self::Output` [src]

### `impl Cmp<UTerm> for UTerm` [src]

Zero == Zero

#### `type Output = Equal`

#### `fn compare<IM: InternalMarker>(&self, _: &UTerm) -> Self::Output` [src]

### `impl<Nl: Unsigned + NonZero, Nr: Cmp<Nl> + Unsigned + NonZero> Cmp<NInt<Nr>> for NInt<Nl>` [src]

-X <==> -Y

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

#### `fn compare<IM: InternalMarker>(&self, rhs: &NInt<Nr>) -> Self::Output` [src]

### `impl<P: Unsigned + NonZero, N: Unsigned + NonZero> Cmp<NInt<N>> for PInt<P>` [src]

X > - Y

#### `type Output = Greater`

#### `fn compare<IM: InternalMarker>(&self, _: &NInt<N>) -> Self::Output` [src]

### `impl<P: Unsigned + NonZero, N: Unsigned + NonZero> Cmp<PInt<P>> for NInt<N>` [src]

-X < Y

#### `type Output = Less`

#### `fn compare<IM: InternalMarker>(&self, _: &PInt<P>) -> Self::Output` [src]

### `impl<Pl: Cmp<Pr> + Unsigned + NonZero, Pr: Unsigned + NonZero> Cmp<PInt<Pr>> for PInt<Pl>` [src]

X <==> Y

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

#### `fn compare<IM: InternalMarker>(&self, rhs: &PInt<Pr>) -> Self::Output` [src]

### `impl<U: Unsigned + NonZero> Cmp<NInt<U>> for Z0` [src]

0 > -X

#### `type Output = Greater`

#### `fn compare<IM: InternalMarker>(&self, _: &NInt<U>) -> Self::Output` [src]

### `impl<U: Unsigned + NonZero> Cmp<PInt<U>> for Z0` [src]

0 < X

#### `type Output = Less`

#### `fn compare<IM: InternalMarker>(&self, _: &PInt<U>) -> Self::Output` [src]

### `impl<U: Unsigned + NonZero> Cmp<Z0> for NInt<U>` [src]

-X < 0

#### `type Output = Less`

#### `fn compare<IM: InternalMarker>(&self, _: &Z0) -> Self::Output` [src]

### `impl<U: Unsigned + NonZero> Cmp<Z0> for PInt<U>` [src]

X > 0

#### `type Output = Greater`

#### `fn compare<IM: InternalMarker>(&self, _: &Z0) -> Self::Output` [src]

### `impl<U: Unsigned, B: Bit> Cmp<UInt<U, B>> for UTerm` [src]

Zero < Nonzero

#### `type Output = Less`

#### `fn compare<IM: InternalMarker>(&self, _: &UInt<U, B>) -> Self::Output` [src]

### `impl<U: Unsigned, B: Bit> Cmp<UTerm> for UInt<U, B>` [src]

Nonzero > Zero

#### `type Output = Greater`

#### `fn compare<IM: InternalMarker>(&self, _: &UTerm) -> Self::Output` [src]

### `impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B0> where
Ul: PrivateCmp<Ur, Equal>,` [src]

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

#### `type Output = PrivateCmpOut<Ul, Ur, Equal>`

#### `fn compare<IM: InternalMarker>(&self, rhs: &UInt<Ur, B0>) -> Self::Output` [src]

### `impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B0>> for UInt<Ul, B1> where
Ul: PrivateCmp<Ur, Greater>,` [src]

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

#### `type Output = PrivateCmpOut<Ul, Ur, Greater>`

#### `fn compare<IM: InternalMarker>(&self, rhs: &UInt<Ur, B0>) -> Self::Output` [src]

### `impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B1>> for UInt<Ul, B0> where
Ul: PrivateCmp<Ur, Less>,` [src]

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

#### `type Output = PrivateCmpOut<Ul, Ur, Less>`

#### `fn compare<IM: InternalMarker>(&self, rhs: &UInt<Ur, B1>) -> Self::Output` [src]

### `impl<Ul: Unsigned, Ur: Unsigned> Cmp<UInt<Ur, B1>> for UInt<Ul, B1> where
Ul: PrivateCmp<Ur, Equal>,` [src]

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

#### `type Output = PrivateCmpOut<Ul, Ur, Equal>`

#### `fn compare<IM: InternalMarker>(&self, rhs: &UInt<Ur, B1>) -> Self::Output` [src]

Loading content...