pub trait NumRef<'a>{
type Own: Num;
Show 21 methods
// Provided methods
fn num_to_owned(&self) -> Result<Self::Own>
where Self::Own: Clone { ... }
fn num_set(&mut self, value: <Self::Own as Num>::Inner) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_set_ref(&mut self, value: &<Self::Own as Num>::Inner) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_is_zero(&self) -> Result<bool> { ... }
fn num_get_zero() -> Result<Self::Own> { ... }
fn num_set_zero(&mut self) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_is_one(&self) -> Result<bool> { ... }
fn num_get_one() -> Result<Self::Own> { ... }
fn num_set_one(&mut self) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_add(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_add_assign(
&mut self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_sub(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_sub_assign(
&mut self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_mul(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_mul_assign(
&mut self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_div(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_div_assign(
&mut self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_rem(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_rem_assign(
&mut self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<()>
where Self: DerefMut<Target = Self::Own> { ... }
fn num_ref_neg(&self) -> Result<<Self::Own as Num>::Out> { ... }
fn num_ref_abs(&self) -> Result<<Self::Own as Num>::Out> { ... }
}
Expand description
Common auto-trait for referenced numeric types.
It is automatically implemented for references of types implementing Num
.
Mutable operations are only available for exclusive (&mut
) references.
Required Associated Types§
Provided Methods§
Sourcefn num_to_owned(&self) -> Result<Self::Own>
fn num_to_owned(&self) -> Result<Self::Own>
Returns the owned version of self
, if it can be cloned.
Sourcefn num_set(&mut self, value: <Self::Own as Num>::Inner) -> Result<()>
fn num_set(&mut self, value: <Self::Own as Num>::Inner) -> Result<()>
Sets self
to a valid value
.
Sourcefn num_set_ref(&mut self, value: &<Self::Own as Num>::Inner) -> Result<()>
fn num_set_ref(&mut self, value: &<Self::Own as Num>::Inner) -> Result<()>
Sets self
to a valid &value
.
Sourcefn num_is_zero(&self) -> Result<bool>
fn num_is_zero(&self) -> Result<bool>
Returns true
if self
is zero.
Sourcefn num_get_zero() -> Result<Self::Own>
fn num_get_zero() -> Result<Self::Own>
Returns the number zero.
Sourcefn num_set_zero(&mut self) -> Result<()>
fn num_set_zero(&mut self) -> Result<()>
Sets self
to zero.
Sourcefn num_is_one(&self) -> Result<bool>
fn num_is_one(&self) -> Result<bool>
Returns true
if self
is one.
Sourcefn num_get_one() -> Result<Self::Own>
fn num_get_one() -> Result<Self::Own>
Returns the number one.
Sourcefn num_set_one(&mut self) -> Result<()>
fn num_set_one(&mut self) -> Result<()>
Sets the number to one.
Sourcefn num_ref_add(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out>
fn num_ref_add( &self, rhs: &<Self::Own as Num>::Rhs, ) -> Result<<Self::Own as Num>::Out>
Computes &self + &rhs
.
Sourcefn num_ref_add_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
fn num_ref_add_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
Computes &mut self += &rhs
.
Sourcefn num_ref_sub(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out>
fn num_ref_sub( &self, rhs: &<Self::Own as Num>::Rhs, ) -> Result<<Self::Own as Num>::Out>
Computes &self - &rhs
.
Sourcefn num_ref_sub_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
fn num_ref_sub_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
Computes &mut self -= &rhs
.
Sourcefn num_ref_mul(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out>
fn num_ref_mul( &self, rhs: &<Self::Own as Num>::Rhs, ) -> Result<<Self::Own as Num>::Out>
Computes &self * &rhs
.
Sourcefn num_ref_mul_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
fn num_ref_mul_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
Computes &mut self *= &rhs
.
Sourcefn num_ref_div(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out>
fn num_ref_div( &self, rhs: &<Self::Own as Num>::Rhs, ) -> Result<<Self::Own as Num>::Out>
Computes &self / &rhs
.
Sourcefn num_ref_div_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
fn num_ref_div_assign(&mut self, rhs: &<Self::Own as Num>::Rhs) -> Result<()>
Computes &mut self /= &rhs
.
Sourcefn num_ref_rem(
&self,
rhs: &<Self::Own as Num>::Rhs,
) -> Result<<Self::Own as Num>::Out>
fn num_ref_rem( &self, rhs: &<Self::Own as Num>::Rhs, ) -> Result<<Self::Own as Num>::Out>
Computes &self % &rhs
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.