|
3 | 3 | use crate::fmt;
|
4 | 4 | use crate::ops::{Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign};
|
5 | 5 | use crate::ops::{BitXor, BitXorAssign, Div, DivAssign};
|
6 |
| -use crate::ops::{Mul, MulAssign, Neg, Not}; |
| 6 | +use crate::ops::{Mul, MulAssign, Neg, Not, Rem, RemAssign}; |
7 | 7 | use crate::ops::{Shl, ShlAssign, Shr, ShrAssign, Sub, SubAssign};
|
8 | 8 |
|
9 | 9 | /// Provides intentionally-wrapped arithmetic on `T`.
|
@@ -288,6 +288,27 @@ macro_rules! saturating_impl {
|
288 | 288 | }
|
289 | 289 | forward_ref_op_assign! { impl DivAssign, div_assign for Saturating<$t>, Saturating<$t> }
|
290 | 290 |
|
| 291 | + #[unstable(feature = "saturating_int_impl", issue = "87920")] |
| 292 | + impl Rem for Saturating<$t> { |
| 293 | + type Output = Saturating<$t>; |
| 294 | + |
| 295 | + #[inline] |
| 296 | + fn rem(self, other: Saturating<$t>) -> Saturating<$t> { |
| 297 | + Saturating(self.0.rem(other.0)) |
| 298 | + } |
| 299 | + } |
| 300 | + forward_ref_binop! { impl Rem, rem for Saturating<$t>, Saturating<$t>, |
| 301 | + #[unstable(feature = "saturating_int_impl", issue = "87920")] } |
| 302 | + |
| 303 | + #[unstable(feature = "saturating_int_impl", issue = "87920")] |
| 304 | + impl RemAssign for Saturating<$t> { |
| 305 | + #[inline] |
| 306 | + fn rem_assign(&mut self, other: Saturating<$t>) { |
| 307 | + *self = *self % other; |
| 308 | + } |
| 309 | + } |
| 310 | + forward_ref_op_assign! { impl RemAssign, rem_assign for Saturating<$t>, Saturating<$t> } |
| 311 | + |
291 | 312 | #[unstable(feature = "saturating_int_impl", issue = "87920")]
|
292 | 313 | impl Not for Saturating<$t> {
|
293 | 314 | type Output = Saturating<$t>;
|
|
0 commit comments