pub trait AverageRoundAssign<RHS = Self> {
// Required method
fn average_round_assign(&mut self, other: RHS, rm: RoundingMode) -> Ordering;
}Expand description
Computes the average (arithmetic mean) of two numbers, rounding according to a specified
rounding mode and replacing the first number with it. An Ordering is returned, indicating
whether the assigned value is less than, equal to, or greater than the exact value.
The average is computed without overflow: the result is always exact or within a half of the exact value, so it always fits in the same type as the inputs.
Required Methods§
fn average_round_assign(&mut self, other: RHS, rm: RoundingMode) -> Ordering
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl AverageRoundAssign for i8
impl AverageRoundAssign for i8
Source§fn average_round_assign(&mut self, other: i8, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: i8, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for i16
impl AverageRoundAssign for i16
Source§fn average_round_assign(&mut self, other: i16, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: i16, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for i32
impl AverageRoundAssign for i32
Source§fn average_round_assign(&mut self, other: i32, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: i32, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for i64
impl AverageRoundAssign for i64
Source§fn average_round_assign(&mut self, other: i64, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: i64, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for i128
impl AverageRoundAssign for i128
Source§fn average_round_assign(&mut self, other: i128, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: i128, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for isize
impl AverageRoundAssign for isize
Source§fn average_round_assign(&mut self, other: isize, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: isize, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for u8
impl AverageRoundAssign for u8
Source§fn average_round_assign(&mut self, other: u8, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: u8, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for u16
impl AverageRoundAssign for u16
Source§fn average_round_assign(&mut self, other: u16, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: u16, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for u32
impl AverageRoundAssign for u32
Source§fn average_round_assign(&mut self, other: u32, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: u32, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for u64
impl AverageRoundAssign for u64
Source§fn average_round_assign(&mut self, other: u64, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: u64, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for u128
impl AverageRoundAssign for u128
Source§fn average_round_assign(&mut self, other: u128, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: u128, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.
Source§impl AverageRoundAssign for usize
impl AverageRoundAssign for usize
Source§fn average_round_assign(&mut self, other: usize, rm: RoundingMode) -> Ordering
fn average_round_assign(&mut self, other: usize, rm: RoundingMode) -> Ordering
Computes the average (arithmetic mean) of two numbers, rounding according to a
specified rounding mode and replacing the first number with it. An Ordering is
returned, indicating whether the assigned value is less than, equal to, or greater
than the exact value.
The average is computed without overflow; the result always fits in the same type as the inputs.
See the AverageRound documentation for details.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if rm is Exact but the average of self and other is not an integer.
§Examples
See here.