Struct peano::Succ
[−]
[src]
pub struct Succ<N: NonNeg> { /* 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: Copy + NonNeg> Copy for Succ<N>
[src]
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: 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 as Add<Rhs>>::Output: NonNeg,
[src]
Lhs: NonNeg + Add<Rhs>,
Rhs: NonNeg,
<Lhs as Add<Rhs>>::Output: NonNeg,
Add non-negative numbers to positive numbers (e.g. 2 + 3, 2 + 0)
type Output = Succ<<Lhs as Add<Rhs>>::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]
Lhs: NonNeg + Add<Rhs>,
Rhs: NonPos,
Add negative and positive numbers (e.g. 2 + -3)
type Output = <Lhs as Add<Rhs>>::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 as Neg>::Output: NonPos,
[src]
N: NonNeg + Neg,
<N as Neg>::Output: NonPos,
Negate positive numbers (e.g. 5 -> -5)
type Output = Pred<<N as Neg>::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]
Lhs: NonNeg,
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]
Lhs: NonNeg + Sub<Rhs>,
Rhs: NonNeg,
Subtract positive numbers from positive numbers (e.g. 3 - 4)
type Output = <Lhs as Sub<Rhs>>::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 as Sub<Rhs>>::Output: NonNeg,
[src]
Lhs: NonNeg + Sub<Rhs>,
Rhs: NonPos,
<Lhs as Sub<Rhs>>::Output: NonNeg,
Subtract negative numbers from positive numbers (e.g. 3 - -4)
type Output = Succ<Succ<<Lhs as Sub<Rhs>>::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 as Mul<Rhs>>::Output>,
[src]
Lhs: NonNeg + Mul<Rhs>,
Rhs: Add<<Lhs as Mul<Rhs>>::Output>,
Multiply positive numbers by integers (e.g. 2 * N)
type Output = <Rhs as Add<<Lhs as Mul<Rhs>>::Output>>::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]
Lhs: NonNeg,
Succ<Lhs>: DivPrivate<Rhs>,
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> as DivPrivate<Rhs>>::Output
The resulting type after applying the /
operator
fn div(self, rhs: Rhs) -> Self::Output
The method for the /
operator