feat: implement more operator overrides for Cycles

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-01-19 00:29:04 -06:00
parent 9b4c95ce4c
commit 9143286e9c
1 changed files with 18 additions and 0 deletions

View File

@ -2136,12 +2136,30 @@ impl std::ops::Rem<u32> for Cycles {
}
}
impl std::ops::RemAssign for Cycles {
fn rem_assign(&mut self, rhs: Self) {
*self = Self(self.0 % rhs.0);
}
}
impl std::ops::RemAssign<u32> for Cycles {
fn rem_assign(&mut self, rhs: u32) {
*self = Self(self.0 % rhs);
}
}
impl From<u32> for Cycles {
fn from(num: u32) -> Self {
Self(num)
}
}
impl From<Cycles> for u32 {
fn from(cycles: Cycles) -> Self {
cycles.0
}
}
#[cfg(test)]
mod tests {
use super::Cycles;