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
Required Methods
fn from_repr(repr: Self::Repr) -> Option<Self>
Converts from Self::Repr to Self.
fn to_repr(self) -> Self::Repr
Converts from Self to Self::Repr.
fn min_value() -> Self
Returns the smallest value that can be represented as Self.
fn max_value() -> Self
Returns the largest value that can be represented as Self.
Provided Methods
fn checked_add(self, other: Self) -> Option<Self>
Checked integer addition.
fn checked_sub(self, other: Self) -> Option<Self>
Checked integer subtraction.
fn checked_mul(self, other: Self) -> Option<Self>
Checked integer multiplication.
fn checked_div(self, other: Self) -> Option<Self>
Checked integer division.
fn checked_rem(self, other: Self) -> Option<Self>
Checked integer remainder.
fn checked_neg(self) -> Option<Self>
Checked integer negation.
fn checked_add_repr(self, other: Self::Repr) -> Option<Self>
Checked integer addition with Self::Repr.
fn checked_sub_repr(self, other: Self::Repr) -> Option<Self>
Checked integer subtraction with Self::Repr.
fn checked_mul_repr(self, other: Self::Repr) -> Option<Self>
Checked integer multiplication with Self::Repr.
fn checked_div_repr(self, other: Self::Repr) -> Option<Self>
Checked integer division with Self::Repr.
fn checked_rem_repr(self, other: Self::Repr) -> Option<Self>
Checked integer remainder with Self::Repr.
fn saturating_add(self, other: Self) -> Self
Saturating integer addition.
fn saturating_sub(self, other: Self) -> Self
Saturating integer subtraction.
fn saturating_mul(self, other: Self) -> Self
Saturating integer multiplication.
fn saturating_add_repr(self, other: Self::Repr) -> Self
Saturating integer addition with Self::Repr.
fn saturating_sub_repr(self, other: Self::Repr) -> Self
Saturating integer subtraction with Self::Repr.
fn saturating_mul_repr(self, other: Self::Repr) -> Self
Saturating integer multiplication with Self::Repr.