pub trait RoundToMultipleAssign<RHS = Self> {
    // Required method
    fn round_to_multiple_assign(
        &mut self,
        other: RHS,
        rm: RoundingMode
    ) -> Ordering;
}
Expand description

Rounds a number to a multiple of another number in place, according to a specified rounding mode. Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

Required Methods§

source

fn round_to_multiple_assign(&mut self, other: RHS, rm: RoundingMode) -> Ordering

Implementations on Foreign Types§

source§

impl RoundToMultipleAssign for i8

source§

fn round_to_multiple_assign(&mut self, other: i8, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for i16

source§

fn round_to_multiple_assign(&mut self, other: i16, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for i32

source§

fn round_to_multiple_assign(&mut self, other: i32, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for i64

source§

fn round_to_multiple_assign(&mut self, other: i64, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for i128

source§

fn round_to_multiple_assign( &mut self, other: i128, rm: RoundingMode ) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for isize

source§

fn round_to_multiple_assign( &mut self, other: isize, rm: RoundingMode ) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding mode that is guaranteed to return without a panic is Down.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for u8

source§

fn round_to_multiple_assign(&mut self, other: u8, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for u16

source§

fn round_to_multiple_assign(&mut self, other: u16, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for u32

source§

fn round_to_multiple_assign(&mut self, other: u32, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for u64

source§

fn round_to_multiple_assign(&mut self, other: u64, rm: RoundingMode) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for u128

source§

fn round_to_multiple_assign( &mut self, other: u128, rm: RoundingMode ) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

source§

impl RoundToMultipleAssign for usize

source§

fn round_to_multiple_assign( &mut self, other: usize, rm: RoundingMode ) -> Ordering

Rounds a number to a multiple of another number in place, according to a specified rounding mode. An Ordering is returned, indicating whether the returned value is less than, equal to, or greater than the original value.

The only rounding modes that are guaranteed to return without a panic are Down and Floor.

See the RoundToMultiple documentation for details.

The following two expressions are equivalent:

  • x.round_to_multiple_assign(other, RoundingMode::Exact);
  • assert!(x.divisible_by(other));

but the latter should be used as it is clearer and more efficient.

§Worst-case complexity

Constant time and additional memory.

§Panics
  • If rm is Exact, but self is not a multiple of other.
  • If the multiple is outside the representable range.
  • If self is nonzero, other is zero, and rm is trying to round away from zero.
§Examples

See here.

Implementors§