Struct peano::Succ [] [src]

pub struct Succ<N: NonNeg> {
    // some fields omitted
}

For any non-negative Peano number N, we define its successor, Succ<N>.

This gives us positive Peano numbers.

Trait Implementations

impl<N: Clone + NonNeg> Clone for Succ<N>
[src]

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

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<N: Copy + NonNeg> Copy for Succ<N>
[src]

impl<N: NonNeg> Peano for Succ<N>
[src]

impl<N: NonNeg> NonNeg for Succ<N>
[src]

impl<N: NonNeg> NonZero for Succ<N>
[src]

impl<Lhs, Rhs> Add<Rhs> for Succ<Lhs> where Lhs: NonNeg + Add<Rhs>, Rhs: NonNeg, Lhs::Output: NonNeg
[src]

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

type Output = Succ<Lhs::Output>

The resulting type after applying the + operator

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

The method for the + operator

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

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

type Output = Lhs::Output

The resulting type after applying the + operator

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

The method for the + operator

impl<N> Neg for Succ<N> where N: NonNeg + Neg, N::Output: NonPos
[src]

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

type Output = Pred<N::Output>

The resulting type after applying the - operator

fn neg(self) -> Self::Output

The method for the unary - operator

impl<Lhs> Sub<Zero> for Succ<Lhs> where Lhs: NonNeg
[src]

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

type Output = Succ<Lhs>

The resulting type after applying the - operator

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

The method for the - operator

impl<Lhs, Rhs> Sub<Succ<Rhs>> for Succ<Lhs> where Lhs: NonNeg + Sub<Rhs>, Rhs: NonNeg
[src]

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

type Output = Lhs::Output

The resulting type after applying the - operator

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

The method for the - operator

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

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

type Output = Succ<Succ<Lhs::Output>>

The resulting type after applying the - operator

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

The method for the - operator

impl<Lhs, Rhs> Mul<Rhs> for Succ<Lhs> where Lhs: NonNeg + Mul<Rhs>, Rhs: Add<Lhs::Output>
[src]

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

type Output = Rhs::Output

The resulting type after applying the * operator

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

The method for the * operator

impl<Lhs, Rhs> Div<Rhs> for Succ<Lhs> where Lhs: NonNeg, Succ<Lhs>: DivPrivate<Rhs>
[src]

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

type Output = Succ<Lhs>::Output

The resulting type after applying the / operator

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

The method for the / operator

impl<N: NonNeg + ToInt> ToInt for Succ<N>
[src]

fn to_int() -> i32