Trait core::ops::DivAssign 1.8.0[−][src]
pub trait DivAssign<Rhs = Self> { fn div_assign(&mut self, rhs: Rhs); }
Expand description
部门分配运算符 /=
。
Examples
use std::ops::DivAssign; #[derive(Debug, PartialEq)] struct Frequency { hertz: f64 } impl DivAssign<f64> for Frequency { fn div_assign(&mut self, rhs: f64) { self.hertz /= rhs; } } let mut frequency = Frequency { hertz: 200.0 }; frequency /= 4.0; assert_eq!(Frequency { hertz: 50.0 }, frequency);Run