Trait bounded_integer::BoundedInteger [] [src]

pub trait BoundedInteger: Copy + Eq + Ord {
    type Repr: Repr;
    fn from_repr(repr: Self::Repr) -> Option<Self>;
    fn to_repr(self) -> Self::Repr;
    fn min_value() -> Self;
    fn max_value() -> Self;

    fn checked_add(self, other: Self) -> Option<Self> { ... }
    fn checked_sub(self, other: Self) -> Option<Self> { ... }
    fn checked_mul(self, other: Self) -> Option<Self> { ... }
    fn checked_div(self, other: Self) -> Option<Self> { ... }
    fn checked_rem(self, other: Self) -> Option<Self> { ... }
    fn checked_neg(self) -> Option<Self> { ... }
    fn checked_add_repr(self, other: Self::Repr) -> Option<Self> { ... }
    fn checked_sub_repr(self, other: Self::Repr) -> Option<Self> { ... }
    fn checked_mul_repr(self, other: Self::Repr) -> Option<Self> { ... }
    fn checked_div_repr(self, other: Self::Repr) -> Option<Self> { ... }
    fn checked_rem_repr(self, other: Self::Repr) -> Option<Self> { ... }
    fn saturating_add(self, other: Self) -> Self { ... }
    fn saturating_sub(self, other: Self) -> Self { ... }
    fn saturating_mul(self, other: Self) -> Self { ... }
    fn saturating_add_repr(self, other: Self::Repr) -> Self { ... }
    fn saturating_sub_repr(self, other: Self::Repr) -> Self { ... }
    fn saturating_mul_repr(self, other: Self::Repr) -> Self { ... }
}

Bounded integers.

Provides conversion, minimum, maximum, checked and saturating arithmetic.

Associated Types

Integer representation.

Should reflect the #[repr(...)] attribute of Self.

Required Methods

Converts from Self::Repr to Self.

Converts from Self to Self::Repr.

Returns the smallest value that can be represented as Self.

Returns the largest value that can be represented as Self.

Provided Methods

Checked integer addition.

Checked integer subtraction.

Checked integer multiplication.

Checked integer division.

Checked integer remainder.

Checked integer negation.

Checked integer addition with Self::Repr.

Checked integer subtraction with Self::Repr.

Checked integer multiplication with Self::Repr.

Checked integer division with Self::Repr.

Checked integer remainder with Self::Repr.

Saturating integer addition.

Saturating integer subtraction.

Saturating integer multiplication.

Saturating integer addition with Self::Repr.

Saturating integer subtraction with Self::Repr.

Saturating integer multiplication with Self::Repr.

Implementors