1 /// The addition operator `+`.
3 /// Note that `Rhs` is `Self` by default, but this is not mandatory. For
4 /// example, [`std::time::SystemTime`] implements `Add<Duration>`, which permits
5 /// operations of the form `SystemTime = SystemTime + Duration`.
7 /// [`std::time::SystemTime`]: ../../std/time/struct.SystemTime.html
11 /// ## `Add`able points
14 /// use std::ops::Add;
16 /// #[derive(Debug, Copy, Clone, PartialEq)]
22 /// impl Add for Point {
23 /// type Output = Self;
25 /// fn add(self, other: Self) -> Self {
27 /// x: self.x + other.x,
28 /// y: self.y + other.y,
33 /// assert_eq!(Point { x: 1, y: 0 } + Point { x: 2, y: 3 },
34 /// Point { x: 3, y: 3 });
37 /// ## Implementing `Add` with generics
39 /// Here is an example of the same `Point` struct implementing the `Add` trait
43 /// use std::ops::Add;
45 /// #[derive(Debug, Copy, Clone, PartialEq)]
51 /// // Notice that the implementation uses the associated type `Output`.
52 /// impl<T: Add<Output = T>> Add for Point<T> {
53 /// type Output = Self;
55 /// fn add(self, other: Self) -> Self::Output {
57 /// x: self.x + other.x,
58 /// y: self.y + other.y,
63 /// assert_eq!(Point { x: 1, y: 0 } + Point { x: 2, y: 3 },
64 /// Point { x: 3, y: 3 });
67 #[stable(feature = "rust1", since = "1.0.0")]
68 #[rustc_on_unimplemented(
69 on(all(_Self = "{integer}", Rhs = "{float}"), message = "cannot add a float to an integer",),
70 on(all(_Self = "{float}", Rhs = "{integer}"), message = "cannot add an integer to a float",),
71 message = "cannot add `{Rhs}` to `{Self}`",
72 label = "no implementation for `{Self} + {Rhs}`"
75 pub trait Add<Rhs = Self> {
76 /// The resulting type after applying the `+` operator.
77 #[stable(feature = "rust1", since = "1.0.0")]
80 /// Performs the `+` operation.
85 /// assert_eq!(12 + 1, 13);
88 #[stable(feature = "rust1", since = "1.0.0")]
89 fn add(self, rhs: Rhs) -> Self::Output;
92 macro_rules! add_impl {
94 #[stable(feature = "rust1", since = "1.0.0")]
99 #[rustc_inherit_overflow_checks]
100 fn add(self, other: $t) -> $t { self + other }
103 forward_ref_binop! { impl Add, add for $t, $t }
107 add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
109 /// The subtraction operator `-`.
111 /// Note that `Rhs` is `Self` by default, but this is not mandatory. For
112 /// example, [`std::time::SystemTime`] implements `Sub<Duration>`, which permits
113 /// operations of the form `SystemTime = SystemTime - Duration`.
115 /// [`std::time::SystemTime`]: ../../std/time/struct.SystemTime.html
119 /// ## `Sub`tractable points
122 /// use std::ops::Sub;
124 /// #[derive(Debug, Copy, Clone, PartialEq)]
130 /// impl Sub for Point {
131 /// type Output = Self;
133 /// fn sub(self, other: Self) -> Self::Output {
135 /// x: self.x - other.x,
136 /// y: self.y - other.y,
141 /// assert_eq!(Point { x: 3, y: 3 } - Point { x: 2, y: 3 },
142 /// Point { x: 1, y: 0 });
145 /// ## Implementing `Sub` with generics
147 /// Here is an example of the same `Point` struct implementing the `Sub` trait
151 /// use std::ops::Sub;
153 /// #[derive(Debug, PartialEq)]
154 /// struct Point<T> {
159 /// // Notice that the implementation uses the associated type `Output`.
160 /// impl<T: Sub<Output = T>> Sub for Point<T> {
161 /// type Output = Self;
163 /// fn sub(self, other: Self) -> Self::Output {
165 /// x: self.x - other.x,
166 /// y: self.y - other.y,
171 /// assert_eq!(Point { x: 2, y: 3 } - Point { x: 1, y: 0 },
172 /// Point { x: 1, y: 3 });
175 #[stable(feature = "rust1", since = "1.0.0")]
176 #[rustc_on_unimplemented(
177 message = "cannot subtract `{Rhs}` from `{Self}`",
178 label = "no implementation for `{Self} - {Rhs}`"
181 pub trait Sub<Rhs = Self> {
182 /// The resulting type after applying the `-` operator.
183 #[stable(feature = "rust1", since = "1.0.0")]
186 /// Performs the `-` operation.
191 /// assert_eq!(12 - 1, 11);
194 #[stable(feature = "rust1", since = "1.0.0")]
195 fn sub(self, rhs: Rhs) -> Self::Output;
198 macro_rules! sub_impl {
200 #[stable(feature = "rust1", since = "1.0.0")]
205 #[rustc_inherit_overflow_checks]
206 fn sub(self, other: $t) -> $t { self - other }
209 forward_ref_binop! { impl Sub, sub for $t, $t }
213 sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
215 /// The multiplication operator `*`.
217 /// Note that `Rhs` is `Self` by default, but this is not mandatory.
221 /// ## `Mul`tipliable rational numbers
224 /// use std::ops::Mul;
226 /// // By the fundamental theorem of arithmetic, rational numbers in lowest
227 /// // terms are unique. So, by keeping `Rational`s in reduced form, we can
228 /// // derive `Eq` and `PartialEq`.
229 /// #[derive(Debug, Eq, PartialEq)]
230 /// struct Rational {
231 /// numerator: usize,
232 /// denominator: usize,
236 /// fn new(numerator: usize, denominator: usize) -> Self {
237 /// if denominator == 0 {
238 /// panic!("Zero is an invalid denominator!");
241 /// // Reduce to lowest terms by dividing by the greatest common
243 /// let gcd = gcd(numerator, denominator);
245 /// numerator: numerator / gcd,
246 /// denominator: denominator / gcd,
251 /// impl Mul for Rational {
252 /// // The multiplication of rational numbers is a closed operation.
253 /// type Output = Self;
255 /// fn mul(self, rhs: Self) -> Self {
256 /// let numerator = self.numerator * rhs.numerator;
257 /// let denominator = self.denominator * rhs.denominator;
258 /// Self::new(numerator, denominator)
262 /// // Euclid's two-thousand-year-old algorithm for finding the greatest common
264 /// fn gcd(x: usize, y: usize) -> usize {
275 /// assert_eq!(Rational::new(1, 2), Rational::new(2, 4));
276 /// assert_eq!(Rational::new(2, 3) * Rational::new(3, 4),
277 /// Rational::new(1, 2));
280 /// ## Multiplying vectors by scalars as in linear algebra
283 /// use std::ops::Mul;
285 /// struct Scalar { value: usize }
287 /// #[derive(Debug, PartialEq)]
288 /// struct Vector { value: Vec<usize> }
290 /// impl Mul<Scalar> for Vector {
291 /// type Output = Self;
293 /// fn mul(self, rhs: Scalar) -> Self::Output {
294 /// Self { value: self.value.iter().map(|v| v * rhs.value).collect() }
298 /// let vector = Vector { value: vec![2, 4, 6] };
299 /// let scalar = Scalar { value: 3 };
300 /// assert_eq!(vector * scalar, Vector { value: vec![6, 12, 18] });
303 #[stable(feature = "rust1", since = "1.0.0")]
304 #[rustc_on_unimplemented(
305 message = "cannot multiply `{Self}` by `{Rhs}`",
306 label = "no implementation for `{Self} * {Rhs}`"
309 pub trait Mul<Rhs = Self> {
310 /// The resulting type after applying the `*` operator.
311 #[stable(feature = "rust1", since = "1.0.0")]
314 /// Performs the `*` operation.
319 /// assert_eq!(12 * 2, 24);
322 #[stable(feature = "rust1", since = "1.0.0")]
323 fn mul(self, rhs: Rhs) -> Self::Output;
326 macro_rules! mul_impl {
328 #[stable(feature = "rust1", since = "1.0.0")]
333 #[rustc_inherit_overflow_checks]
334 fn mul(self, other: $t) -> $t { self * other }
337 forward_ref_binop! { impl Mul, mul for $t, $t }
341 mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
343 /// The division operator `/`.
345 /// Note that `Rhs` is `Self` by default, but this is not mandatory.
349 /// ## `Div`idable rational numbers
352 /// use std::ops::Div;
354 /// // By the fundamental theorem of arithmetic, rational numbers in lowest
355 /// // terms are unique. So, by keeping `Rational`s in reduced form, we can
356 /// // derive `Eq` and `PartialEq`.
357 /// #[derive(Debug, Eq, PartialEq)]
358 /// struct Rational {
359 /// numerator: usize,
360 /// denominator: usize,
364 /// fn new(numerator: usize, denominator: usize) -> Self {
365 /// if denominator == 0 {
366 /// panic!("Zero is an invalid denominator!");
369 /// // Reduce to lowest terms by dividing by the greatest common
371 /// let gcd = gcd(numerator, denominator);
373 /// numerator: numerator / gcd,
374 /// denominator: denominator / gcd,
379 /// impl Div for Rational {
380 /// // The division of rational numbers is a closed operation.
381 /// type Output = Self;
383 /// fn div(self, rhs: Self) -> Self::Output {
384 /// if rhs.numerator == 0 {
385 /// panic!("Cannot divide by zero-valued `Rational`!");
388 /// let numerator = self.numerator * rhs.denominator;
389 /// let denominator = self.denominator * rhs.numerator;
390 /// Self::new(numerator, denominator)
394 /// // Euclid's two-thousand-year-old algorithm for finding the greatest common
396 /// fn gcd(x: usize, y: usize) -> usize {
407 /// assert_eq!(Rational::new(1, 2), Rational::new(2, 4));
408 /// assert_eq!(Rational::new(1, 2) / Rational::new(3, 4),
409 /// Rational::new(2, 3));
412 /// ## Dividing vectors by scalars as in linear algebra
415 /// use std::ops::Div;
417 /// struct Scalar { value: f32 }
419 /// #[derive(Debug, PartialEq)]
420 /// struct Vector { value: Vec<f32> }
422 /// impl Div<Scalar> for Vector {
423 /// type Output = Self;
425 /// fn div(self, rhs: Scalar) -> Self::Output {
426 /// Self { value: self.value.iter().map(|v| v / rhs.value).collect() }
430 /// let scalar = Scalar { value: 2f32 };
431 /// let vector = Vector { value: vec![2f32, 4f32, 6f32] };
432 /// assert_eq!(vector / scalar, Vector { value: vec![1f32, 2f32, 3f32] });
435 #[stable(feature = "rust1", since = "1.0.0")]
436 #[rustc_on_unimplemented(
437 message = "cannot divide `{Self}` by `{Rhs}`",
438 label = "no implementation for `{Self} / {Rhs}`"
441 pub trait Div<Rhs = Self> {
442 /// The resulting type after applying the `/` operator.
443 #[stable(feature = "rust1", since = "1.0.0")]
446 /// Performs the `/` operation.
451 /// assert_eq!(12 / 2, 6);
454 #[stable(feature = "rust1", since = "1.0.0")]
455 fn div(self, rhs: Rhs) -> Self::Output;
458 macro_rules! div_impl_integer {
459 ($(($($t:ty)*) => $panic:expr),*) => ($($(
460 /// This operation rounds towards zero, truncating any
461 /// fractional part of the exact result.
466 #[stable(feature = "rust1", since = "1.0.0")]
471 fn div(self, other: $t) -> $t { self / other }
474 forward_ref_binop! { impl Div, div for $t, $t }
479 (usize u8 u16 u32 u64 u128) => "This operation will panic if `other == 0`.",
480 (isize i8 i16 i32 i64 i128) => "This operation will panic if `other == 0` or the division results in overflow."
483 macro_rules! div_impl_float {
485 #[stable(feature = "rust1", since = "1.0.0")]
490 fn div(self, other: $t) -> $t { self / other }
493 forward_ref_binop! { impl Div, div for $t, $t }
497 div_impl_float! { f32 f64 }
499 /// The remainder operator `%`.
501 /// Note that `Rhs` is `Self` by default, but this is not mandatory.
505 /// This example implements `Rem` on a `SplitSlice` object. After `Rem` is
506 /// implemented, one can use the `%` operator to find out what the remaining
507 /// elements of the slice would be after splitting it into equal slices of a
511 /// use std::ops::Rem;
513 /// #[derive(PartialEq, Debug)]
514 /// struct SplitSlice<'a, T: 'a> {
518 /// impl<'a, T> Rem<usize> for SplitSlice<'a, T> {
519 /// type Output = Self;
521 /// fn rem(self, modulus: usize) -> Self::Output {
522 /// let len = self.slice.len();
523 /// let rem = len % modulus;
524 /// let start = len - rem;
525 /// Self {slice: &self.slice[start..]}
529 /// // If we were to divide &[0, 1, 2, 3, 4, 5, 6, 7] into slices of size 3,
530 /// // the remainder would be &[6, 7].
531 /// assert_eq!(SplitSlice { slice: &[0, 1, 2, 3, 4, 5, 6, 7] } % 3,
532 /// SplitSlice { slice: &[6, 7] });
535 #[stable(feature = "rust1", since = "1.0.0")]
536 #[rustc_on_unimplemented(
537 message = "cannot mod `{Self}` by `{Rhs}`",
538 label = "no implementation for `{Self} % {Rhs}`"
541 pub trait Rem<Rhs = Self> {
542 /// The resulting type after applying the `%` operator.
543 #[stable(feature = "rust1", since = "1.0.0")]
546 /// Performs the `%` operation.
551 /// assert_eq!(12 % 10, 2);
554 #[stable(feature = "rust1", since = "1.0.0")]
555 fn rem(self, rhs: Rhs) -> Self::Output;
558 macro_rules! rem_impl_integer {
559 ($(($($t:ty)*) => $panic:expr),*) => ($($(
560 /// This operation satisfies `n % d == n - (n / d) * d`. The
561 /// result has the same sign as the left operand.
566 #[stable(feature = "rust1", since = "1.0.0")]
571 fn rem(self, other: $t) -> $t { self % other }
574 forward_ref_binop! { impl Rem, rem for $t, $t }
579 (usize u8 u16 u32 u64 u128) => "This operation will panic if `other == 0`.",
580 (isize i8 i16 i32 i64 i128) => "This operation will panic if `other == 0` or if `self / other` results in overflow."
583 macro_rules! rem_impl_float {
586 /// The remainder from the division of two floats.
588 /// The remainder has the same sign as the dividend and is computed as:
589 /// `x - (x / y).trunc() * y`.
593 /// let x: f32 = 50.50;
594 /// let y: f32 = 8.125;
595 /// let remainder = x - (x / y).trunc() * y;
597 /// // The answer to both operations is 1.75
598 /// assert_eq!(x % y, remainder);
600 #[stable(feature = "rust1", since = "1.0.0")]
605 fn rem(self, other: $t) -> $t { self % other }
608 forward_ref_binop! { impl Rem, rem for $t, $t }
612 rem_impl_float! { f32 f64 }
614 /// The unary negation operator `-`.
618 /// An implementation of `Neg` for `Sign`, which allows the use of `-` to
619 /// negate its value.
622 /// use std::ops::Neg;
624 /// #[derive(Debug, PartialEq)]
631 /// impl Neg for Sign {
632 /// type Output = Self;
634 /// fn neg(self) -> Self::Output {
636 /// Sign::Negative => Sign::Positive,
637 /// Sign::Zero => Sign::Zero,
638 /// Sign::Positive => Sign::Negative,
643 /// // A negative positive is a negative.
644 /// assert_eq!(-Sign::Positive, Sign::Negative);
645 /// // A double negative is a positive.
646 /// assert_eq!(-Sign::Negative, Sign::Positive);
647 /// // Zero is its own negation.
648 /// assert_eq!(-Sign::Zero, Sign::Zero);
651 #[stable(feature = "rust1", since = "1.0.0")]
654 /// The resulting type after applying the `-` operator.
655 #[stable(feature = "rust1", since = "1.0.0")]
658 /// Performs the unary `-` operation.
664 /// assert_eq!(-x, -12);
667 #[stable(feature = "rust1", since = "1.0.0")]
668 fn neg(self) -> Self::Output;
671 macro_rules! neg_impl {
673 #[stable(feature = "rust1", since = "1.0.0")]
678 #[rustc_inherit_overflow_checks]
679 fn neg(self) -> $t { -self }
682 forward_ref_unop! { impl Neg, neg for $t }
686 neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 }
688 /// The addition assignment operator `+=`.
692 /// This example creates a `Point` struct that implements the `AddAssign`
693 /// trait, and then demonstrates add-assigning to a mutable `Point`.
696 /// use std::ops::AddAssign;
698 /// #[derive(Debug, Copy, Clone, PartialEq)]
704 /// impl AddAssign for Point {
705 /// fn add_assign(&mut self, other: Self) {
707 /// x: self.x + other.x,
708 /// y: self.y + other.y,
713 /// let mut point = Point { x: 1, y: 0 };
714 /// point += Point { x: 2, y: 3 };
715 /// assert_eq!(point, Point { x: 3, y: 3 });
717 #[lang = "add_assign"]
718 #[stable(feature = "op_assign_traits", since = "1.8.0")]
719 #[rustc_on_unimplemented(
720 message = "cannot add-assign `{Rhs}` to `{Self}`",
721 label = "no implementation for `{Self} += {Rhs}`"
725 pub trait AddAssign<Rhs = Self> {
726 /// Performs the `+=` operation.
731 /// let mut x: u32 = 12;
733 /// assert_eq!(x, 13);
735 #[stable(feature = "op_assign_traits", since = "1.8.0")]
736 fn add_assign(&mut self, rhs: Rhs);
739 macro_rules! add_assign_impl {
741 #[stable(feature = "op_assign_traits", since = "1.8.0")]
742 impl AddAssign for $t {
744 #[rustc_inherit_overflow_checks]
745 fn add_assign(&mut self, other: $t) { *self += other }
748 forward_ref_op_assign! { impl AddAssign, add_assign for $t, $t }
752 add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
754 /// The subtraction assignment operator `-=`.
758 /// This example creates a `Point` struct that implements the `SubAssign`
759 /// trait, and then demonstrates sub-assigning to a mutable `Point`.
762 /// use std::ops::SubAssign;
764 /// #[derive(Debug, Copy, Clone, PartialEq)]
770 /// impl SubAssign for Point {
771 /// fn sub_assign(&mut self, other: Self) {
773 /// x: self.x - other.x,
774 /// y: self.y - other.y,
779 /// let mut point = Point { x: 3, y: 3 };
780 /// point -= Point { x: 2, y: 3 };
781 /// assert_eq!(point, Point {x: 1, y: 0});
783 #[lang = "sub_assign"]
784 #[stable(feature = "op_assign_traits", since = "1.8.0")]
785 #[rustc_on_unimplemented(
786 message = "cannot subtract-assign `{Rhs}` from `{Self}`",
787 label = "no implementation for `{Self} -= {Rhs}`"
791 pub trait SubAssign<Rhs = Self> {
792 /// Performs the `-=` operation.
797 /// let mut x: u32 = 12;
799 /// assert_eq!(x, 11);
801 #[stable(feature = "op_assign_traits", since = "1.8.0")]
802 fn sub_assign(&mut self, rhs: Rhs);
805 macro_rules! sub_assign_impl {
807 #[stable(feature = "op_assign_traits", since = "1.8.0")]
808 impl SubAssign for $t {
810 #[rustc_inherit_overflow_checks]
811 fn sub_assign(&mut self, other: $t) { *self -= other }
814 forward_ref_op_assign! { impl SubAssign, sub_assign for $t, $t }
818 sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
820 /// The multiplication assignment operator `*=`.
825 /// use std::ops::MulAssign;
827 /// #[derive(Debug, PartialEq)]
828 /// struct Frequency { hertz: f64 }
830 /// impl MulAssign<f64> for Frequency {
831 /// fn mul_assign(&mut self, rhs: f64) {
832 /// self.hertz *= rhs;
836 /// let mut frequency = Frequency { hertz: 50.0 };
837 /// frequency *= 4.0;
838 /// assert_eq!(Frequency { hertz: 200.0 }, frequency);
840 #[lang = "mul_assign"]
841 #[stable(feature = "op_assign_traits", since = "1.8.0")]
842 #[rustc_on_unimplemented(
843 message = "cannot multiply-assign `{Self}` by `{Rhs}`",
844 label = "no implementation for `{Self} *= {Rhs}`"
848 pub trait MulAssign<Rhs = Self> {
849 /// Performs the `*=` operation.
854 /// let mut x: u32 = 12;
856 /// assert_eq!(x, 24);
858 #[stable(feature = "op_assign_traits", since = "1.8.0")]
859 fn mul_assign(&mut self, rhs: Rhs);
862 macro_rules! mul_assign_impl {
864 #[stable(feature = "op_assign_traits", since = "1.8.0")]
865 impl MulAssign for $t {
867 #[rustc_inherit_overflow_checks]
868 fn mul_assign(&mut self, other: $t) { *self *= other }
871 forward_ref_op_assign! { impl MulAssign, mul_assign for $t, $t }
875 mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
877 /// The division assignment operator `/=`.
882 /// use std::ops::DivAssign;
884 /// #[derive(Debug, PartialEq)]
885 /// struct Frequency { hertz: f64 }
887 /// impl DivAssign<f64> for Frequency {
888 /// fn div_assign(&mut self, rhs: f64) {
889 /// self.hertz /= rhs;
893 /// let mut frequency = Frequency { hertz: 200.0 };
894 /// frequency /= 4.0;
895 /// assert_eq!(Frequency { hertz: 50.0 }, frequency);
897 #[lang = "div_assign"]
898 #[stable(feature = "op_assign_traits", since = "1.8.0")]
899 #[rustc_on_unimplemented(
900 message = "cannot divide-assign `{Self}` by `{Rhs}`",
901 label = "no implementation for `{Self} /= {Rhs}`"
905 pub trait DivAssign<Rhs = Self> {
906 /// Performs the `/=` operation.
911 /// let mut x: u32 = 12;
913 /// assert_eq!(x, 6);
915 #[stable(feature = "op_assign_traits", since = "1.8.0")]
916 fn div_assign(&mut self, rhs: Rhs);
919 macro_rules! div_assign_impl {
921 #[stable(feature = "op_assign_traits", since = "1.8.0")]
922 impl DivAssign for $t {
924 fn div_assign(&mut self, other: $t) { *self /= other }
927 forward_ref_op_assign! { impl DivAssign, div_assign for $t, $t }
931 div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
933 /// The remainder assignment operator `%=`.
938 /// use std::ops::RemAssign;
940 /// struct CookieJar { cookies: u32 }
942 /// impl RemAssign<u32> for CookieJar {
943 /// fn rem_assign(&mut self, piles: u32) {
944 /// self.cookies %= piles;
948 /// let mut jar = CookieJar { cookies: 31 };
951 /// println!("Splitting up {} cookies into {} even piles!", jar.cookies, piles);
955 /// println!("{} cookies remain in the cookie jar!", jar.cookies);
957 #[lang = "rem_assign"]
958 #[stable(feature = "op_assign_traits", since = "1.8.0")]
959 #[rustc_on_unimplemented(
960 message = "cannot mod-assign `{Self}` by `{Rhs}``",
961 label = "no implementation for `{Self} %= {Rhs}`"
965 pub trait RemAssign<Rhs = Self> {
966 /// Performs the `%=` operation.
971 /// let mut x: u32 = 12;
973 /// assert_eq!(x, 2);
975 #[stable(feature = "op_assign_traits", since = "1.8.0")]
976 fn rem_assign(&mut self, rhs: Rhs);
979 macro_rules! rem_assign_impl {
981 #[stable(feature = "op_assign_traits", since = "1.8.0")]
982 impl RemAssign for $t {
984 fn rem_assign(&mut self, other: $t) { *self %= other }
987 forward_ref_op_assign! { impl RemAssign, rem_assign for $t, $t }
991 rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }