Trait collections::std::ops::SubAssign
[−]
[src]
pub trait SubAssign<Rhs = Self> { fn sub_assign(&mut self, Rhs); }
The SubAssign
trait is used to specify the functionality of -=
.
Examples
A trivial implementation of SubAssign
. When Foo -= Foo
happens, it ends up
calling sub_assign
, and therefore, main
prints Subtracting!
.
#![feature(augmented_assignments)] #![feature(op_assign_traits)] use std::ops::SubAssign; struct Foo; impl SubAssign for Foo { fn sub_assign(&mut self, _rhs: Foo) { println!("Subtracting!"); } } fn main() { let mut foo = Foo; foo -= Foo; }
Required Methods
fn sub_assign(&mut self, Rhs)
The method for the -=
operator
Implementors
impl SubAssign<Wrapping<usize>> for Wrapping<usize>
impl SubAssign<Wrapping<u8>> for Wrapping<u8>
impl SubAssign<Wrapping<u16>> for Wrapping<u16>
impl SubAssign<Wrapping<u32>> for Wrapping<u32>
impl SubAssign<Wrapping<u64>> for Wrapping<u64>
impl SubAssign<Wrapping<isize>> for Wrapping<isize>
impl SubAssign<Wrapping<i8>> for Wrapping<i8>
impl SubAssign<Wrapping<i16>> for Wrapping<i16>
impl SubAssign<Wrapping<i32>> for Wrapping<i32>
impl SubAssign<Wrapping<i64>> for Wrapping<i64>
impl SubAssign<usize> for usize
impl SubAssign<u8> for u8
impl SubAssign<u16> for u16
impl SubAssign<u32> for u32
impl SubAssign<u64> for u64
impl SubAssign<isize> for isize
impl SubAssign<i8> for i8
impl SubAssign<i16> for i16
impl SubAssign<i32> for i32
impl SubAssign<i64> for i64
impl SubAssign<f32> for f32
impl SubAssign<f64> for f64