Trait bounded_integer::Repr [] [src]

pub trait Repr: Copy + Eq + Ord {
    fn is_negative(self) -> bool;
    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>;
}

Integer representation.

Reflects the types valid in #[repr(...)] for C-like enums, so should not be implemented for additional types.

Required Methods

fn is_negative(self) -> bool

Returns true if negative.

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.

Implementors