pub enum Signed<T> {
Negative(T),
Positive(T),
}
Expand description
A signed wrapper.
This wrapper allows representing a signed value from a type which is originally unsigned. In C APIs, this is represented by a tuple with a signed integer positive or negative and the absolute value.
Variants§
Implementations§
source§impl Signed<ClockTime>
impl Signed<ClockTime>
sourcepub fn from_nseconds(val: Signed<u64>) -> Self
pub fn from_nseconds(val: Signed<u64>) -> Self
Creates new value from nanoseconds.
sourcepub fn from_useconds(val: Signed<u64>) -> Self
pub fn from_useconds(val: Signed<u64>) -> Self
Creates new value from microseconds.
sourcepub fn from_mseconds(val: Signed<u64>) -> Self
pub fn from_mseconds(val: Signed<u64>) -> Self
Creates new value from milliseconds.
sourcepub fn seconds_f32(self) -> f32
pub fn seconds_f32(self) -> f32
Returns the self
in f32 seconds.
sourcepub fn seconds_f64(self) -> f64
pub fn seconds_f64(self) -> f64
Returns the self
in f64 seconds.
sourcepub fn from_seconds(val: Signed<u64>) -> Self
pub fn from_seconds(val: Signed<u64>) -> Self
Creates new value from seconds.
sourcepub fn try_from_seconds_f32(seconds: f32) -> Result<Self, TryFromFloatSecsError>
pub fn try_from_seconds_f32(seconds: f32) -> Result<Self, TryFromFloatSecsError>
Builds a new Signed<ClockTime>
which value is the given number of seconds.
Returns an error if seconds is infinite or NaN, or
the resulting duration in nanoseconds exceeds the u64
range.
sourcepub fn from_seconds_f32(seconds: f32) -> Self
pub fn from_seconds_f32(seconds: f32) -> Self
Builds a new Signed<ClockTime>
which value is the given number of seconds.
§Panics
Panics if seconds is infinite or NaN, or the resulting duration
in nanoseconds exceeds the u64
range.
sourcepub fn try_from_seconds_f64(seconds: f64) -> Result<Self, TryFromFloatSecsError>
pub fn try_from_seconds_f64(seconds: f64) -> Result<Self, TryFromFloatSecsError>
Builds a new Signed<ClockTime>
which value is the given number of seconds.
Returns an error if seconds is infinite or NaN, or
the resulting duration in nanoseconds exceeds the u64
range.
sourcepub fn from_seconds_f64(seconds: f64) -> Self
pub fn from_seconds_f64(seconds: f64) -> Self
Builds a new Signed<ClockTime>
which value is the given number of seconds.
§Panics
Panics if seconds is infinite or NaN, or the resulting duration
in nanoseconds exceeds the u64
range.
source§impl Signed<ClockTime>
impl Signed<ClockTime>
sourcepub fn into_inner_signed(self) -> Signed<u64>
pub fn into_inner_signed(self) -> Signed<u64>
Returns a Signed
containing the inner type of self
.
source§impl Signed<ClockTime>
impl Signed<ClockTime>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: ClockTime) -> Option<Self>
pub fn checked_sub_unsigned(self, other: ClockTime) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: ClockTime) -> Option<Self>
pub fn checked_add_unsigned(self, other: ClockTime) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: ClockTime) -> Self
pub fn saturating_sub_unsigned(self, other: ClockTime) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: ClockTime) -> Self
pub fn saturating_add_unsigned(self, other: ClockTime) -> Self
Returns the saturating addition self + other
.
source§impl Signed<ClockTime>
impl Signed<ClockTime>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl Signed<Other>
impl Signed<Other>
sourcepub fn into_inner_signed(self) -> Signed<u64>
pub fn into_inner_signed(self) -> Signed<u64>
Returns a Signed
containing the inner type of self
.
source§impl Signed<Other>
impl Signed<Other>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: Other) -> Option<Self>
pub fn checked_sub_unsigned(self, other: Other) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: Other) -> Option<Self>
pub fn checked_add_unsigned(self, other: Other) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: Other) -> Self
pub fn saturating_sub_unsigned(self, other: Other) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: Other) -> Self
pub fn saturating_add_unsigned(self, other: Other) -> Self
Returns the saturating addition self + other
.
source§impl Signed<Other>
impl Signed<Other>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl<T> Signed<T>
impl<T> Signed<T>
pub fn is_positive(self) -> bool
sourcepub fn positive(self) -> Option<T>
pub fn positive(self) -> Option<T>
Returns Some(value)
, where value
is the inner value,
if self
is positive.
sourcepub fn positive_or<E>(self, err: E) -> Result<T, E>
pub fn positive_or<E>(self, err: E) -> Result<T, E>
Transforms the Signed<T>
into a Result<T, E>
,
mapping Positive(v)
to Ok(v)
and Negative(_)
to Err(err)
.
sourcepub fn positive_or_else<E, F: FnOnce(T) -> E>(self, err: F) -> Result<T, E>
pub fn positive_or_else<E, F: FnOnce(T) -> E>(self, err: F) -> Result<T, E>
Transforms the Signed<T>
into a Result<T, E>
,
mapping Positive(v)
to Ok(v)
and Negative(v)
to Err(err(v))
.
pub fn is_negative(self) -> bool
sourcepub fn negative(self) -> Option<T>
pub fn negative(self) -> Option<T>
Returns Some(value)
, where value
is the inner value,
if self
is negative.
sourcepub fn negative_or<E>(self, err: E) -> Result<T, E>
pub fn negative_or<E>(self, err: E) -> Result<T, E>
Transforms the Signed<T>
into a Result<T, E>
,
mapping Negative(v)
to Ok(v)
and Positive(_)
to Err(err)
.
sourcepub fn negative_or_else<E, F: FnOnce(T) -> E>(self, err: F) -> Result<T, E>
pub fn negative_or_else<E, F: FnOnce(T) -> E>(self, err: F) -> Result<T, E>
Transforms the Signed<T>
into a Result<T, E>
,
mapping Negative(v)
to Ok(v)
and Positive(_)
to Err(err(v))
.
source§impl Signed<u64>
impl Signed<u64>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: u64) -> Option<Self>
pub fn checked_sub_unsigned(self, other: u64) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: u64) -> Option<Self>
pub fn checked_add_unsigned(self, other: u64) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: u64) -> Self
pub fn saturating_sub_unsigned(self, other: u64) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: u64) -> Self
pub fn saturating_add_unsigned(self, other: u64) -> Self
Returns the saturating addition self + other
.
source§impl Signed<u64>
impl Signed<u64>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl Signed<u32>
impl Signed<u32>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: u32) -> Option<Self>
pub fn checked_sub_unsigned(self, other: u32) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: u32) -> Option<Self>
pub fn checked_add_unsigned(self, other: u32) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: u32) -> Self
pub fn saturating_sub_unsigned(self, other: u32) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: u32) -> Self
pub fn saturating_add_unsigned(self, other: u32) -> Self
Returns the saturating addition self + other
.
source§impl Signed<u32>
impl Signed<u32>
pub fn checked_div(self, rhs: i32) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u32) -> Option<Self>
pub fn checked_rem(self, rhs: i32) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u32) -> Option<Self>
pub fn checked_mul(self, rhs: i32) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u32) -> Option<Self>
pub fn saturating_mul(self, rhs: i32) -> Self
pub fn saturating_mul_unsigned(self, rhs: u32) -> Self
source§impl Signed<usize>
impl Signed<usize>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: usize) -> Option<Self>
pub fn checked_sub_unsigned(self, other: usize) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: usize) -> Option<Self>
pub fn checked_add_unsigned(self, other: usize) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: usize) -> Self
pub fn saturating_sub_unsigned(self, other: usize) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: usize) -> Self
pub fn saturating_add_unsigned(self, other: usize) -> Self
Returns the saturating addition self + other
.
source§impl Signed<usize>
impl Signed<usize>
pub fn checked_div(self, rhs: isize) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: usize) -> Option<Self>
pub fn checked_rem(self, rhs: isize) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: usize) -> Option<Self>
pub fn checked_mul(self, rhs: isize) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: usize) -> Option<Self>
pub fn saturating_mul(self, rhs: isize) -> Self
pub fn saturating_mul_unsigned(self, rhs: usize) -> Self
source§impl Signed<Buffers>
impl Signed<Buffers>
sourcepub fn into_inner_signed(self) -> Signed<u64>
pub fn into_inner_signed(self) -> Signed<u64>
Returns a Signed
containing the inner type of self
.
source§impl Signed<Buffers>
impl Signed<Buffers>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: Buffers) -> Option<Self>
pub fn checked_sub_unsigned(self, other: Buffers) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: Buffers) -> Option<Self>
pub fn checked_add_unsigned(self, other: Buffers) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: Buffers) -> Self
pub fn saturating_sub_unsigned(self, other: Buffers) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: Buffers) -> Self
pub fn saturating_add_unsigned(self, other: Buffers) -> Self
Returns the saturating addition self + other
.
source§impl Signed<Buffers>
impl Signed<Buffers>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl Signed<Bytes>
impl Signed<Bytes>
sourcepub fn into_inner_signed(self) -> Signed<u64>
pub fn into_inner_signed(self) -> Signed<u64>
Returns a Signed
containing the inner type of self
.
source§impl Signed<Bytes>
impl Signed<Bytes>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: Bytes) -> Option<Self>
pub fn checked_sub_unsigned(self, other: Bytes) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: Bytes) -> Option<Self>
pub fn checked_add_unsigned(self, other: Bytes) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: Bytes) -> Self
pub fn saturating_sub_unsigned(self, other: Bytes) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: Bytes) -> Self
pub fn saturating_add_unsigned(self, other: Bytes) -> Self
Returns the saturating addition self + other
.
source§impl Signed<Bytes>
impl Signed<Bytes>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl Signed<Default>
impl Signed<Default>
sourcepub fn into_inner_signed(self) -> Signed<u64>
pub fn into_inner_signed(self) -> Signed<u64>
Returns a Signed
containing the inner type of self
.
source§impl Signed<Default>
impl Signed<Default>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: Default) -> Option<Self>
pub fn checked_sub_unsigned(self, other: Default) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: Default) -> Option<Self>
pub fn checked_add_unsigned(self, other: Default) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: Default) -> Self
pub fn saturating_sub_unsigned(self, other: Default) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: Default) -> Self
pub fn saturating_add_unsigned(self, other: Default) -> Self
Returns the saturating addition self + other
.
source§impl Signed<Default>
impl Signed<Default>
pub fn checked_div(self, rhs: i64) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_rem(self, rhs: i64) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: i64) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u64) -> Option<Self>
pub fn saturating_mul(self, rhs: i64) -> Self
pub fn saturating_mul_unsigned(self, rhs: u64) -> Self
source§impl Signed<Percent>
impl Signed<Percent>
sourcepub fn into_inner_signed(self) -> Signed<u32>
pub fn into_inner_signed(self) -> Signed<u32>
Returns a Signed
containing the inner type of self
.
source§impl Signed<Percent>
impl Signed<Percent>
sourcepub fn signum(self) -> i32
pub fn signum(self) -> i32
Returns the signum for this Signed
.
Returns:
0
if the number is zero.1
if the value must be considered as positive.-1
if the value must be considered as negative.
sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_sub_unsigned(self, other: Percent) -> Option<Self>
pub fn checked_sub_unsigned(self, other: Percent) -> Option<Self>
Returns the checked subtraction self - other
.
sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn checked_add_unsigned(self, other: Percent) -> Option<Self>
pub fn checked_add_unsigned(self, other: Percent) -> Option<Self>
Returns the checked addition self + other
.
sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_sub_unsigned(self, other: Percent) -> Self
pub fn saturating_sub_unsigned(self, other: Percent) -> Self
Returns the saturating subtraction self - other
.
sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Returns the saturating addition self + other
.
sourcepub fn saturating_add_unsigned(self, other: Percent) -> Self
pub fn saturating_add_unsigned(self, other: Percent) -> Self
Returns the saturating addition self + other
.
source§impl Signed<Percent>
impl Signed<Percent>
pub fn checked_div(self, rhs: i32) -> Option<Self>
pub fn checked_div_unsigned(self, rhs: u32) -> Option<Self>
pub fn checked_rem(self, rhs: i32) -> Option<Self>
pub fn checked_rem_unsigned(self, rhs: u32) -> Option<Self>
pub fn checked_mul(self, rhs: i32) -> Option<Self>
pub fn checked_mul_unsigned(self, rhs: u32) -> Option<Self>
pub fn saturating_mul(self, rhs: i32) -> Self
pub fn saturating_mul_unsigned(self, rhs: u32) -> Self
Trait Implementations§
source§impl AddAssign<Buffers> for Signed<Buffers>
impl AddAssign<Buffers> for Signed<Buffers>
source§fn add_assign(&mut self, other: Buffers)
fn add_assign(&mut self, other: Buffers)
+=
operation. Read moresource§impl AddAssign<Bytes> for Signed<Bytes>
impl AddAssign<Bytes> for Signed<Bytes>
source§fn add_assign(&mut self, other: Bytes)
fn add_assign(&mut self, other: Bytes)
+=
operation. Read moresource§impl AddAssign<ClockTime> for Signed<ClockTime>
impl AddAssign<ClockTime> for Signed<ClockTime>
source§fn add_assign(&mut self, other: ClockTime)
fn add_assign(&mut self, other: ClockTime)
+=
operation. Read moresource§impl AddAssign<Default> for Signed<Default>
impl AddAssign<Default> for Signed<Default>
source§fn add_assign(&mut self, other: Default)
fn add_assign(&mut self, other: Default)
+=
operation. Read moresource§impl AddAssign<Other> for Signed<Other>
impl AddAssign<Other> for Signed<Other>
source§fn add_assign(&mut self, other: Other)
fn add_assign(&mut self, other: Other)
+=
operation. Read moresource§impl AddAssign<Percent> for Signed<Percent>
impl AddAssign<Percent> for Signed<Percent>
source§fn add_assign(&mut self, other: Percent)
fn add_assign(&mut self, other: Percent)
+=
operation. Read moresource§impl AddAssign<u32> for Signed<u32>
impl AddAssign<u32> for Signed<u32>
source§fn add_assign(&mut self, other: u32)
fn add_assign(&mut self, other: u32)
+=
operation. Read moresource§impl AddAssign<u64> for Signed<u64>
impl AddAssign<u64> for Signed<u64>
source§fn add_assign(&mut self, other: u64)
fn add_assign(&mut self, other: u64)
+=
operation. Read moresource§impl AddAssign<usize> for Signed<usize>
impl AddAssign<usize> for Signed<usize>
source§fn add_assign(&mut self, other: usize)
fn add_assign(&mut self, other: usize)
+=
operation. Read moresource§impl AddAssign for Signed<Buffers>
impl AddAssign for Signed<Buffers>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<Bytes>
impl AddAssign for Signed<Bytes>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<ClockTime>
impl AddAssign for Signed<ClockTime>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<Default>
impl AddAssign for Signed<Default>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<Other>
impl AddAssign for Signed<Other>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<Percent>
impl AddAssign for Signed<Percent>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<u32>
impl AddAssign for Signed<u32>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<u64>
impl AddAssign for Signed<u64>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AddAssign for Signed<usize>
impl AddAssign for Signed<usize>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl<'de, T> Deserialize<'de> for Signed<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Signed<T>where
T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T> Displayable for Signed<Option<T>>
impl<T> Displayable for Signed<Option<T>>
type DisplayImpl = DisplayableOptionSigned<T>
fn display(self) -> Self::DisplayImpl
source§impl<T> Displayable for Signed<T>where
T: Display + SignedIntrinsic,
impl<T> Displayable for Signed<T>where
T: Display + SignedIntrinsic,
type DisplayImpl = Signed<T>
fn display(self) -> Self::DisplayImpl
source§impl DivAssign<i32> for Signed<Percent>
impl DivAssign<i32> for Signed<Percent>
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/=
operation. Read moresource§impl DivAssign<i32> for Signed<u32>
impl DivAssign<i32> for Signed<u32>
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<Buffers>
impl DivAssign<i64> for Signed<Buffers>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<Bytes>
impl DivAssign<i64> for Signed<Bytes>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<ClockTime>
impl DivAssign<i64> for Signed<ClockTime>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<Default>
impl DivAssign<i64> for Signed<Default>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<Other>
impl DivAssign<i64> for Signed<Other>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i64> for Signed<u64>
impl DivAssign<i64> for Signed<u64>
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<isize> for Signed<usize>
impl DivAssign<isize> for Signed<usize>
source§fn div_assign(&mut self, rhs: isize)
fn div_assign(&mut self, rhs: isize)
/=
operation. Read moresource§impl DivAssign<u32> for Signed<Percent>
impl DivAssign<u32> for Signed<Percent>
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moresource§impl DivAssign<u32> for Signed<u32>
impl DivAssign<u32> for Signed<u32>
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<Buffers>
impl DivAssign<u64> for Signed<Buffers>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<Bytes>
impl DivAssign<u64> for Signed<Bytes>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<ClockTime>
impl DivAssign<u64> for Signed<ClockTime>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<Default>
impl DivAssign<u64> for Signed<Default>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<Other>
impl DivAssign<u64> for Signed<Other>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u64> for Signed<u64>
impl DivAssign<u64> for Signed<u64>
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<usize> for Signed<usize>
impl DivAssign<usize> for Signed<usize>
source§fn div_assign(&mut self, rhs: usize)
fn div_assign(&mut self, rhs: usize)
/=
operation. Read moresource§impl MulAssign<i32> for Signed<Percent>
impl MulAssign<i32> for Signed<Percent>
source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
*=
operation. Read moresource§impl MulAssign<i32> for Signed<u32>
impl MulAssign<i32> for Signed<u32>
source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<Buffers>
impl MulAssign<i64> for Signed<Buffers>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<Bytes>
impl MulAssign<i64> for Signed<Bytes>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<ClockTime>
impl MulAssign<i64> for Signed<ClockTime>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<Default>
impl MulAssign<i64> for Signed<Default>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<Other>
impl MulAssign<i64> for Signed<Other>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i64> for Signed<u64>
impl MulAssign<i64> for Signed<u64>
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<isize> for Signed<usize>
impl MulAssign<isize> for Signed<usize>
source§fn mul_assign(&mut self, rhs: isize)
fn mul_assign(&mut self, rhs: isize)
*=
operation. Read moresource§impl MulAssign<u32> for Signed<Percent>
impl MulAssign<u32> for Signed<Percent>
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresource§impl MulAssign<u32> for Signed<u32>
impl MulAssign<u32> for Signed<u32>
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<Buffers>
impl MulAssign<u64> for Signed<Buffers>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<Bytes>
impl MulAssign<u64> for Signed<Bytes>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<ClockTime>
impl MulAssign<u64> for Signed<ClockTime>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<Default>
impl MulAssign<u64> for Signed<Default>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<Other>
impl MulAssign<u64> for Signed<Other>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u64> for Signed<u64>
impl MulAssign<u64> for Signed<u64>
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<usize> for Signed<usize>
impl MulAssign<usize> for Signed<usize>
source§fn mul_assign(&mut self, rhs: usize)
fn mul_assign(&mut self, rhs: usize)
*=
operation. Read moresource§impl MulDiv<i32> for Signed<Percent>
impl MulDiv<i32> for Signed<Percent>
source§fn mul_div_floor(self, num: i32, denom: i32) -> Option<Self>
fn mul_div_floor(self, num: i32, denom: i32) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i32, denom: i32) -> Option<Self>
fn mul_div_round(self, num: i32, denom: i32) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i32> for Signed<u32>
impl MulDiv<i32> for Signed<u32>
source§fn mul_div_floor(self, num: i32, denom: i32) -> Option<Self>
fn mul_div_floor(self, num: i32, denom: i32) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i32, denom: i32) -> Option<Self>
fn mul_div_round(self, num: i32, denom: i32) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<Buffers>
impl MulDiv<i64> for Signed<Buffers>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<Bytes>
impl MulDiv<i64> for Signed<Bytes>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<ClockTime>
impl MulDiv<i64> for Signed<ClockTime>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<Default>
impl MulDiv<i64> for Signed<Default>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<Other>
impl MulDiv<i64> for Signed<Other>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<i64> for Signed<u64>
impl MulDiv<i64> for Signed<u64>
source§fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_floor(self, num: i64, denom: i64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
fn mul_div_round(self, num: i64, denom: i64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u32> for Signed<Percent>
impl MulDiv<u32> for Signed<Percent>
source§fn mul_div_floor(self, num: u32, denom: u32) -> Option<Self>
fn mul_div_floor(self, num: u32, denom: u32) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u32, denom: u32) -> Option<Self>
fn mul_div_round(self, num: u32, denom: u32) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u32> for Signed<u32>
impl MulDiv<u32> for Signed<u32>
source§fn mul_div_floor(self, num: u32, denom: u32) -> Option<Self>
fn mul_div_floor(self, num: u32, denom: u32) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u32, denom: u32) -> Option<Self>
fn mul_div_round(self, num: u32, denom: u32) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<Buffers>
impl MulDiv<u64> for Signed<Buffers>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<Bytes>
impl MulDiv<u64> for Signed<Bytes>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<ClockTime>
impl MulDiv<u64> for Signed<ClockTime>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<Default>
impl MulDiv<u64> for Signed<Default>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<Other>
impl MulDiv<u64> for Signed<Other>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read moresource§impl MulDiv<u64> for Signed<u64>
impl MulDiv<u64> for Signed<u64>
source§fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_floor(self, num: u64, denom: u64) -> Option<Self>
floor(val * num / denom)
, i.e. the largest integer less than or equal to the
result of the division. Read moresource§fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
fn mul_div_round(self, num: u64, denom: u64) -> Option<Self>
round(val * num / denom)
, i.e. the closest integer to the result of the
division. If both surrounding integers are the same distance (x.5
), the one with the bigger
absolute value is returned (round away from 0.0). Read more