Crate overflower_support [] [src]

This defines some traits so we can replace ops with method calls of the respective traits (provided they're in scope) without worrying about argument types (hopefully)

The traits are: * AddPanic, SubPanic, MulPanic, DivPanic, RemPanic, ShlPanic, ShrPanic, NegPanic * AddWrap, SubWrap, Mulwrap, DivWrap, RemWrap, ShlWrap, ShrWrap, NegWrap * AddSaturate, SubSaturate, MulSaturate

The *Panic traits all panic on overflow, the *Wrap traits wrap around and the *Saturate traits saturate.

Note: This needs a nightly compiler because it uses the specialization feature.

Traits

AbsPanic

Compute the absolute value of self, panicking on overflow

AbsSaturate

Compute the absolute value of self, saturating on overflow

AbsWrap

Compute the absolute value of self, wrapping on overflow

AddAssignPanic

Add a value to a given value in-place, panicking on overflow

AddAssignWrap

Add a value to a given value in-place, wrapping on overflow

AddPanic

Add two values, panicking on overflow

AddSaturate

Add two values, saturating on overflow

AddWrap

Add two values, wrapping on overflow

DivAssignPanic

Divide this value by a given value in-place, panicking on overflow

DivAssignWrap

Divide a value by a given value in-place, wrapping on overflow

DivPanic

Divide two values, panicking on overflow

DivSaturate

Divide two values, saturating on overflow

DivWrap

Divide two values, wrapping on overflow

MulAssignPanic

Multiply a value with a given value in-place, panicking on overflow

MulAssignWrap

Multiply a value with a given value in-place, wrapping on overflow

MulPanic

Multiply two values, panicking on overflow

MulSaturate

Multiply two values, saturating on overflow

MulWrap

Multiply two values, wrapping on overflow

NegPanic

Negate a value, panic on overflow

NegSaturate

Negate a value, saturate on overflow

NegWrap

Negate a value, wrap on overflow

RemAssignPanic

Get the remainder of dividing this value by a given value in-place, panicking on overflow

RemAssignWrap

Divide a value to a given value, getting the remainder in-place, wrapping on overflow

RemPanic

Get the remainder of dividing one value by another, panicking on overflow

RemSaturate

Divide two values and get the remainder, saturating on overflow

RemWrap

Divide two values and get the remainder, wrapping on overflow

ShlAssignPanic

Shift left in place, panic if bits are shifted out of the value

ShlAssignSaturate

Shift left in place, set self to 0 if the number of bits shifted are higher than the width of the type

ShlAssignWrap

Shift left in place, set self to 0 if the number of bits shifted are higher than the width of the type

ShlPanic

Shift left, panic if bits are shifted out of the value

ShlSaturate

Shift left, return 0 if the number of bits shifted are higher than the width of the type

ShlWrap

Shift left, return 0 if the number of bits shifted are higher than the width of the type

ShrAssignPanic

Shift right in place, panic if the number of bits shifted are higher than the width of the type

ShrAssignSaturate

Shift right in place, set self to 0 if the number of bits shifted are higher than the width of the type

ShrAssignWrap

Shift right in place, set self to 0 if the number of bits shifted are higher than the width of the type

ShrPanic

Shift right, panic if the number of bits shifted are higher than the width of the type

ShrSaturate

Shift right, return 0 if the number of bits shifted are higher than the width of the type

ShrSaturateAssign

Shift right in place, set self to 0 if the number of bits shifted are higher than the width of the type

ShrWrap

Shift right, return 0 if the number of bits shifted are higher than the width of the type

SubAssignPanic

SUbtract a value from a given value in-place, panicking on overflow

SubAssignWrap

Subtract a value from a given value in-place, wrapping on overflow

SubPanic

Subtract two values, panicking on overflow

SubSaturate

Subtract two values, saturating on overflow

SubWrap

Subtract two values, wrapping on overflow