Struct dimensioned::peano::Pred [] [src]

pub struct Pred<N: NonPos> {
    // some fields omitted
}

For any non-positive Peano number N, we define its predecessor, Pred<N>.

This gives us Peano numbers down to -63, as Rust only supports 64 levels of embedded structs.

Trait Implementations

impl<N: NonPos> Peano for Pred<N>

impl<N: NonPos> !NonNeg for Pred<N>

impl<N: NonPos> NonPos for Pred<N>

impl<N: NonPos> NonZero for Pred<N>

impl<Lhs, Rhs> Add<Rhs> for Pred<Lhs> where Lhs: NonPos + Add<Rhs>, Rhs: NonPos, Lhs::Output: NonPos

Add non-positive numbers to negative numbers (e.g. -2 + -3, -2 + 0)

type Output = Pred<Lhs::Output>

fn add(self, rhs: Rhs) -> Self::Output

impl<Lhs, Rhs> Add<Succ<Rhs>> for Pred<Lhs> where Lhs: NonPos + Add<Rhs>, Rhs: NonNeg

Add positive and negative numbers (e.g. -2 + 3)

type Output = Lhs::Output

fn add(self, rhs: Succ<Rhs>) -> Self::Output

impl<N> Neg for Pred<N> where N: NonPos + Neg, N::Output: NonNeg

Negate negative numbers (e.g. -5 -> 5)

type Output = Succ<N::Output>

fn neg(self) -> Self::Output

impl<Lhs> Sub<Zero> for Pred<Lhs> where Lhs: NonPos

Subtract Zero from negative numbers (e.g. -2 - 0)

type Output = Pred<Lhs>

fn sub(self, rhs: Zero) -> Self::Output

impl<Lhs, Rhs> Sub<Pred<Rhs>> for Pred<Lhs> where Lhs: NonPos + Sub<Rhs>, Rhs: NonPos

Subtract negative numbers from negative numbers (e.g. -3 - -4)

type Output = Lhs::Output

fn sub(self, rhs: Pred<Rhs>) -> Self::Output

impl<Lhs, Rhs> Sub<Succ<Rhs>> for Pred<Lhs> where Lhs: NonPos + Sub<Rhs>, Rhs: NonNeg, Lhs::Output: NonPos

Subtract positive numbers from negative numbers (e.g. -3 - 4)

type Output = Pred<Pred<Lhs::Output>>

fn sub(self, rhs: Succ<Rhs>) -> Self::Output

impl<Lhs, Rhs> Mul<Rhs> for Pred<Lhs> where Lhs: NonPos + Mul<Rhs>, Rhs: Peano, Lhs::Output: Sub<Rhs>

Multiply negative numbers by integers (e.g. -2 * N)

type Output = Lhs::Output::Output

fn mul(self, rhs: Rhs) -> Self::Output

impl<Lhs, Rhs> Div<Rhs> for Pred<Lhs> where Lhs: NonPos + Neg, Rhs: Neg, Succ<Lhs::Output>: DivPrivate<Rhs::Output>, Lhs::Output: NonNeg

Divide a negative number by a non-zero number (e.g. -4 / 2, -4 / -2). Only defined for numbers that are evenly divisible.

type Output = Pred<Lhs>::Output::Output

fn div(self, rhs: Rhs) -> Self::Output

impl<N: NonPos + ToInt> ToInt for Pred<N>

fn to_int() -> i32

Derived Implementations

impl<N: Clone + NonPos> Clone for Pred<N> where N: Clone

fn clone(&self) -> Pred<N>

fn clone_from(&mut self, source: &Self)

impl<N: Copy + NonPos> Copy for Pred<N> where N: Copy