1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 /// The unary logical negation operator `!`.
15 /// An implementation of `Not` for `Answer`, which enables the use of `!` to
19 /// use std::ops::Not;
21 /// #[derive(Debug, PartialEq)]
27 /// impl Not for Answer {
28 /// type Output = Answer;
30 /// fn not(self) -> Answer {
32 /// Answer::Yes => Answer::No,
33 /// Answer::No => Answer::Yes
38 /// assert_eq!(!Answer::Yes, Answer::No);
39 /// assert_eq!(!Answer::No, Answer::Yes);
42 #[stable(feature = "rust1", since = "1.0.0")]
44 /// The resulting type after applying the `!` operator.
45 #[stable(feature = "rust1", since = "1.0.0")]
48 /// Performs the unary `!` operation.
49 #[stable(feature = "rust1", since = "1.0.0")]
50 fn not(self) -> Self::Output
;
53 macro_rules
! not_impl
{
55 #[stable(feature = "rust1", since = "1.0.0")]
60 fn not(self) -> $t { !self }
63 forward_ref_unop
! { impl Not, not for $t }
67 not_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
69 /// The bitwise AND operator `&`.
71 /// Note that `RHS` is `Self` by default, but this is not mandatory.
75 /// An implementation of `BitAnd` for a wrapper around `bool`.
78 /// use std::ops::BitAnd;
80 /// #[derive(Debug, PartialEq)]
81 /// struct Scalar(bool);
83 /// impl BitAnd for Scalar {
84 /// type Output = Self;
86 /// // rhs is the "right-hand side" of the expression `a & b`
87 /// fn bitand(self, rhs: Self) -> Self {
88 /// Scalar(self.0 & rhs.0)
92 /// assert_eq!(Scalar(true) & Scalar(true), Scalar(true));
93 /// assert_eq!(Scalar(true) & Scalar(false), Scalar(false));
94 /// assert_eq!(Scalar(false) & Scalar(true), Scalar(false));
95 /// assert_eq!(Scalar(false) & Scalar(false), Scalar(false));
98 /// An implementation of `BitAnd` for a wrapper around `Vec<bool>`.
101 /// use std::ops::BitAnd;
103 /// #[derive(Debug, PartialEq)]
104 /// struct BooleanVector(Vec<bool>);
106 /// impl BitAnd for BooleanVector {
107 /// type Output = Self;
109 /// fn bitand(self, BooleanVector(rhs): Self) -> Self {
110 /// let BooleanVector(lhs) = self;
111 /// assert_eq!(lhs.len(), rhs.len());
112 /// BooleanVector(lhs.iter().zip(rhs.iter()).map(|(x, y)| *x && *y).collect())
116 /// let bv1 = BooleanVector(vec![true, true, false, false]);
117 /// let bv2 = BooleanVector(vec![true, false, true, false]);
118 /// let expected = BooleanVector(vec![true, false, false, false]);
119 /// assert_eq!(bv1 & bv2, expected);
122 #[stable(feature = "rust1", since = "1.0.0")]
123 #[rustc_on_unimplemented = "no implementation for `{Self} & {RHS}`"]
124 pub trait BitAnd
<RHS
=Self> {
125 /// The resulting type after applying the `&` operator.
126 #[stable(feature = "rust1", since = "1.0.0")]
129 /// Performs the `&` operation.
130 #[stable(feature = "rust1", since = "1.0.0")]
131 fn bitand(self, rhs
: RHS
) -> Self::Output
;
134 macro_rules
! bitand_impl
{
136 #[stable(feature = "rust1", since = "1.0.0")]
141 fn bitand(self, rhs
: $t
) -> $t { self & rhs }
144 forward_ref_binop
! { impl BitAnd, bitand for $t, $t }
148 bitand_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
150 /// The bitwise OR operator `|`.
152 /// Note that `RHS` is `Self` by default, but this is not mandatory.
156 /// An implementation of `BitOr` for a wrapper around `bool`.
159 /// use std::ops::BitOr;
161 /// #[derive(Debug, PartialEq)]
162 /// struct Scalar(bool);
164 /// impl BitOr for Scalar {
165 /// type Output = Self;
167 /// // rhs is the "right-hand side" of the expression `a | b`
168 /// fn bitor(self, rhs: Self) -> Self {
169 /// Scalar(self.0 | rhs.0)
173 /// assert_eq!(Scalar(true) | Scalar(true), Scalar(true));
174 /// assert_eq!(Scalar(true) | Scalar(false), Scalar(true));
175 /// assert_eq!(Scalar(false) | Scalar(true), Scalar(true));
176 /// assert_eq!(Scalar(false) | Scalar(false), Scalar(false));
179 /// An implementation of `BitOr` for a wrapper around `Vec<bool>`.
182 /// use std::ops::BitOr;
184 /// #[derive(Debug, PartialEq)]
185 /// struct BooleanVector(Vec<bool>);
187 /// impl BitOr for BooleanVector {
188 /// type Output = Self;
190 /// fn bitor(self, BooleanVector(rhs): Self) -> Self {
191 /// let BooleanVector(lhs) = self;
192 /// assert_eq!(lhs.len(), rhs.len());
193 /// BooleanVector(lhs.iter().zip(rhs.iter()).map(|(x, y)| *x || *y).collect())
197 /// let bv1 = BooleanVector(vec![true, true, false, false]);
198 /// let bv2 = BooleanVector(vec![true, false, true, false]);
199 /// let expected = BooleanVector(vec![true, true, true, false]);
200 /// assert_eq!(bv1 | bv2, expected);
203 #[stable(feature = "rust1", since = "1.0.0")]
204 #[rustc_on_unimplemented = "no implementation for `{Self} | {RHS}`"]
205 pub trait BitOr
<RHS
=Self> {
206 /// The resulting type after applying the `|` operator.
207 #[stable(feature = "rust1", since = "1.0.0")]
210 /// Performs the `|` operation.
211 #[stable(feature = "rust1", since = "1.0.0")]
212 fn bitor(self, rhs
: RHS
) -> Self::Output
;
215 macro_rules
! bitor_impl
{
217 #[stable(feature = "rust1", since = "1.0.0")]
222 fn bitor(self, rhs
: $t
) -> $t { self | rhs }
225 forward_ref_binop
! { impl BitOr, bitor for $t, $t }
229 bitor_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
231 /// The bitwise XOR operator `^`.
233 /// Note that `RHS` is `Self` by default, but this is not mandatory.
237 /// An implementation of `BitXor` that lifts `^` to a wrapper around `bool`.
240 /// use std::ops::BitXor;
242 /// #[derive(Debug, PartialEq)]
243 /// struct Scalar(bool);
245 /// impl BitXor for Scalar {
246 /// type Output = Self;
248 /// // rhs is the "right-hand side" of the expression `a ^ b`
249 /// fn bitxor(self, rhs: Self) -> Self {
250 /// Scalar(self.0 ^ rhs.0)
254 /// assert_eq!(Scalar(true) ^ Scalar(true), Scalar(false));
255 /// assert_eq!(Scalar(true) ^ Scalar(false), Scalar(true));
256 /// assert_eq!(Scalar(false) ^ Scalar(true), Scalar(true));
257 /// assert_eq!(Scalar(false) ^ Scalar(false), Scalar(false));
260 /// An implementation of `BitXor` trait for a wrapper around `Vec<bool>`.
263 /// use std::ops::BitXor;
265 /// #[derive(Debug, PartialEq)]
266 /// struct BooleanVector(Vec<bool>);
268 /// impl BitXor for BooleanVector {
269 /// type Output = Self;
271 /// fn bitxor(self, BooleanVector(rhs): Self) -> Self {
272 /// let BooleanVector(lhs) = self;
273 /// assert_eq!(lhs.len(), rhs.len());
274 /// BooleanVector(lhs.iter()
276 /// .map(|(x, y)| (*x || *y) && !(*x && *y))
281 /// let bv1 = BooleanVector(vec![true, true, false, false]);
282 /// let bv2 = BooleanVector(vec![true, false, true, false]);
283 /// let expected = BooleanVector(vec![false, true, true, false]);
284 /// assert_eq!(bv1 ^ bv2, expected);
287 #[stable(feature = "rust1", since = "1.0.0")]
288 #[rustc_on_unimplemented = "no implementation for `{Self} ^ {RHS}`"]
289 pub trait BitXor
<RHS
=Self> {
290 /// The resulting type after applying the `^` operator.
291 #[stable(feature = "rust1", since = "1.0.0")]
294 /// Performs the `^` operation.
295 #[stable(feature = "rust1", since = "1.0.0")]
296 fn bitxor(self, rhs
: RHS
) -> Self::Output
;
299 macro_rules
! bitxor_impl
{
301 #[stable(feature = "rust1", since = "1.0.0")]
306 fn bitxor(self, other
: $t
) -> $t { self ^ other }
309 forward_ref_binop
! { impl BitXor, bitxor for $t, $t }
313 bitxor_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
315 /// The left shift operator `<<`.
319 /// An implementation of `Shl` that lifts the `<<` operation on integers to a
320 /// wrapper around `usize`.
323 /// use std::ops::Shl;
325 /// #[derive(PartialEq, Debug)]
326 /// struct Scalar(usize);
328 /// impl Shl<Scalar> for Scalar {
329 /// type Output = Self;
331 /// fn shl(self, Scalar(rhs): Self) -> Scalar {
332 /// let Scalar(lhs) = self;
333 /// Scalar(lhs << rhs)
337 /// assert_eq!(Scalar(4) << Scalar(2), Scalar(16));
340 /// An implementation of `Shl` that spins a vector leftward by a given amount.
343 /// use std::ops::Shl;
345 /// #[derive(PartialEq, Debug)]
346 /// struct SpinVector<T: Clone> {
350 /// impl<T: Clone> Shl<usize> for SpinVector<T> {
351 /// type Output = Self;
353 /// fn shl(self, rhs: usize) -> SpinVector<T> {
354 /// // Rotate the vector by `rhs` places.
355 /// let (a, b) = self.vec.split_at(rhs);
356 /// let mut spun_vector: Vec<T> = vec![];
357 /// spun_vector.extend_from_slice(b);
358 /// spun_vector.extend_from_slice(a);
359 /// SpinVector { vec: spun_vector }
363 /// assert_eq!(SpinVector { vec: vec![0, 1, 2, 3, 4] } << 2,
364 /// SpinVector { vec: vec![2, 3, 4, 0, 1] });
367 #[stable(feature = "rust1", since = "1.0.0")]
368 #[rustc_on_unimplemented = "no implementation for `{Self} << {RHS}`"]
370 /// The resulting type after applying the `<<` operator.
371 #[stable(feature = "rust1", since = "1.0.0")]
374 /// Performs the `<<` operation.
375 #[stable(feature = "rust1", since = "1.0.0")]
376 fn shl(self, rhs
: RHS
) -> Self::Output
;
379 macro_rules
! shl_impl
{
381 #[stable(feature = "rust1", since = "1.0.0")]
382 impl Shl
<$f
> for $t
{
386 #[rustc_inherit_overflow_checks]
387 fn shl(self, other
: $f
) -> $t
{
392 forward_ref_binop
! { impl Shl, shl for $t, $f }
396 macro_rules
! shl_impl_all
{
399 shl_impl
! { $t, u16 }
400 shl_impl
! { $t, u32 }
401 shl_impl
! { $t, u64 }
402 shl_impl
! { $t, u128 }
403 shl_impl
! { $t, usize }
406 shl_impl
! { $t, i16 }
407 shl_impl
! { $t, i32 }
408 shl_impl
! { $t, i64 }
409 shl_impl
! { $t, i128 }
410 shl_impl
! { $t, isize }
414 shl_impl_all
! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }
416 /// The right shift operator `>>`.
420 /// An implementation of `Shr` that lifts the `>>` operation on integers to a
421 /// wrapper around `usize`.
424 /// use std::ops::Shr;
426 /// #[derive(PartialEq, Debug)]
427 /// struct Scalar(usize);
429 /// impl Shr<Scalar> for Scalar {
430 /// type Output = Self;
432 /// fn shr(self, Scalar(rhs): Self) -> Scalar {
433 /// let Scalar(lhs) = self;
434 /// Scalar(lhs >> rhs)
438 /// assert_eq!(Scalar(16) >> Scalar(2), Scalar(4));
441 /// An implementation of `Shr` that spins a vector rightward by a given amount.
444 /// use std::ops::Shr;
446 /// #[derive(PartialEq, Debug)]
447 /// struct SpinVector<T: Clone> {
451 /// impl<T: Clone> Shr<usize> for SpinVector<T> {
452 /// type Output = Self;
454 /// fn shr(self, rhs: usize) -> SpinVector<T> {
455 /// // Rotate the vector by `rhs` places.
456 /// let (a, b) = self.vec.split_at(self.vec.len() - rhs);
457 /// let mut spun_vector: Vec<T> = vec![];
458 /// spun_vector.extend_from_slice(b);
459 /// spun_vector.extend_from_slice(a);
460 /// SpinVector { vec: spun_vector }
464 /// assert_eq!(SpinVector { vec: vec![0, 1, 2, 3, 4] } >> 2,
465 /// SpinVector { vec: vec![3, 4, 0, 1, 2] });
468 #[stable(feature = "rust1", since = "1.0.0")]
469 #[rustc_on_unimplemented = "no implementation for `{Self} >> {RHS}`"]
471 /// The resulting type after applying the `>>` operator.
472 #[stable(feature = "rust1", since = "1.0.0")]
475 /// Performs the `>>` operation.
476 #[stable(feature = "rust1", since = "1.0.0")]
477 fn shr(self, rhs
: RHS
) -> Self::Output
;
480 macro_rules
! shr_impl
{
482 #[stable(feature = "rust1", since = "1.0.0")]
483 impl Shr
<$f
> for $t
{
487 #[rustc_inherit_overflow_checks]
488 fn shr(self, other
: $f
) -> $t
{
493 forward_ref_binop
! { impl Shr, shr for $t, $f }
497 macro_rules
! shr_impl_all
{
500 shr_impl
! { $t, u16 }
501 shr_impl
! { $t, u32 }
502 shr_impl
! { $t, u64 }
503 shr_impl
! { $t, u128 }
504 shr_impl
! { $t, usize }
507 shr_impl
! { $t, i16 }
508 shr_impl
! { $t, i32 }
509 shr_impl
! { $t, i64 }
510 shr_impl
! { $t, i128 }
511 shr_impl
! { $t, isize }
515 shr_impl_all
! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
517 /// The bitwise AND assignment operator `&=`.
521 /// An implementation of `BitAndAssign` that lifts the `&=` operator to a
522 /// wrapper around `bool`.
525 /// use std::ops::BitAndAssign;
527 /// #[derive(Debug, PartialEq)]
528 /// struct Scalar(bool);
530 /// impl BitAndAssign for Scalar {
531 /// // rhs is the "right-hand side" of the expression `a &= b`
532 /// fn bitand_assign(&mut self, rhs: Self) {
533 /// *self = Scalar(self.0 & rhs.0)
537 /// let mut scalar = Scalar(true);
538 /// scalar &= Scalar(true);
539 /// assert_eq!(scalar, Scalar(true));
541 /// let mut scalar = Scalar(true);
542 /// scalar &= Scalar(false);
543 /// assert_eq!(scalar, Scalar(false));
545 /// let mut scalar = Scalar(false);
546 /// scalar &= Scalar(true);
547 /// assert_eq!(scalar, Scalar(false));
549 /// let mut scalar = Scalar(false);
550 /// scalar &= Scalar(false);
551 /// assert_eq!(scalar, Scalar(false));
554 /// Here, the `BitAndAssign` trait is implemented for a wrapper around
558 /// use std::ops::BitAndAssign;
560 /// #[derive(Debug, PartialEq)]
561 /// struct BooleanVector(Vec<bool>);
563 /// impl BitAndAssign for BooleanVector {
564 /// // `rhs` is the "right-hand side" of the expression `a &= b`.
565 /// fn bitand_assign(&mut self, rhs: Self) {
566 /// assert_eq!(self.0.len(), rhs.0.len());
567 /// *self = BooleanVector(self.0
569 /// .zip(rhs.0.iter())
570 /// .map(|(x, y)| *x && *y)
575 /// let mut bv = BooleanVector(vec![true, true, false, false]);
576 /// bv &= BooleanVector(vec![true, false, true, false]);
577 /// let expected = BooleanVector(vec![true, false, false, false]);
578 /// assert_eq!(bv, expected);
580 #[lang = "bitand_assign"]
581 #[stable(feature = "op_assign_traits", since = "1.8.0")]
582 #[rustc_on_unimplemented = "no implementation for `{Self} &= {Rhs}`"]
583 pub trait BitAndAssign
<Rhs
=Self> {
584 /// Performs the `&=` operation.
585 #[stable(feature = "op_assign_traits", since = "1.8.0")]
586 fn bitand_assign(&mut self, rhs
: Rhs
);
589 macro_rules
! bitand_assign_impl
{
591 #[stable(feature = "op_assign_traits", since = "1.8.0")]
592 impl BitAndAssign
for $t
{
594 fn bitand_assign(&mut self, other
: $t
) { *self &= other }
597 forward_ref_op_assign
! { impl BitAndAssign, bitand_assign for $t, $t }
601 bitand_assign_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
603 /// The bitwise OR assignment operator `|=`.
608 /// use std::ops::BitOrAssign;
610 /// #[derive(Debug, PartialEq)]
611 /// struct PersonalPreferences {
612 /// likes_cats: bool,
613 /// likes_dogs: bool,
616 /// impl BitOrAssign for PersonalPreferences {
617 /// fn bitor_assign(&mut self, rhs: Self) {
618 /// self.likes_cats |= rhs.likes_cats;
619 /// self.likes_dogs |= rhs.likes_dogs;
623 /// let mut prefs = PersonalPreferences { likes_cats: true, likes_dogs: false };
624 /// prefs |= PersonalPreferences { likes_cats: false, likes_dogs: true };
625 /// assert_eq!(prefs, PersonalPreferences { likes_cats: true, likes_dogs: true });
627 #[lang = "bitor_assign"]
628 #[stable(feature = "op_assign_traits", since = "1.8.0")]
629 #[rustc_on_unimplemented = "no implementation for `{Self} |= {Rhs}`"]
630 pub trait BitOrAssign
<Rhs
=Self> {
631 /// Performs the `|=` operation.
632 #[stable(feature = "op_assign_traits", since = "1.8.0")]
633 fn bitor_assign(&mut self, rhs
: Rhs
);
636 macro_rules
! bitor_assign_impl
{
638 #[stable(feature = "op_assign_traits", since = "1.8.0")]
639 impl BitOrAssign
for $t
{
641 fn bitor_assign(&mut self, other
: $t
) { *self |= other }
644 forward_ref_op_assign
! { impl BitOrAssign, bitor_assign for $t, $t }
648 bitor_assign_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
650 /// The bitwise XOR assignment operator `^=`.
655 /// use std::ops::BitXorAssign;
657 /// #[derive(Debug, PartialEq)]
658 /// struct Personality {
660 /// likes_knitting: bool,
663 /// impl BitXorAssign for Personality {
664 /// fn bitxor_assign(&mut self, rhs: Self) {
665 /// self.has_soul ^= rhs.has_soul;
666 /// self.likes_knitting ^= rhs.likes_knitting;
670 /// let mut personality = Personality { has_soul: false, likes_knitting: true };
671 /// personality ^= Personality { has_soul: true, likes_knitting: true };
672 /// assert_eq!(personality, Personality { has_soul: true, likes_knitting: false});
674 #[lang = "bitxor_assign"]
675 #[stable(feature = "op_assign_traits", since = "1.8.0")]
676 #[rustc_on_unimplemented = "no implementation for `{Self} ^= {Rhs}`"]
677 pub trait BitXorAssign
<Rhs
=Self> {
678 /// Performs the `^=` operation.
679 #[stable(feature = "op_assign_traits", since = "1.8.0")]
680 fn bitxor_assign(&mut self, rhs
: Rhs
);
683 macro_rules
! bitxor_assign_impl
{
685 #[stable(feature = "op_assign_traits", since = "1.8.0")]
686 impl BitXorAssign
for $t
{
688 fn bitxor_assign(&mut self, other
: $t
) { *self ^= other }
691 forward_ref_op_assign
! { impl BitXorAssign, bitxor_assign for $t, $t }
695 bitxor_assign_impl
! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
697 /// The left shift assignment operator `<<=`.
701 /// An implementation of `ShlAssign` for a wrapper around `usize`.
704 /// use std::ops::ShlAssign;
706 /// #[derive(Debug, PartialEq)]
707 /// struct Scalar(usize);
709 /// impl ShlAssign<usize> for Scalar {
710 /// fn shl_assign(&mut self, rhs: usize) {
715 /// let mut scalar = Scalar(4);
717 /// assert_eq!(scalar, Scalar(16));
719 #[lang = "shl_assign"]
720 #[stable(feature = "op_assign_traits", since = "1.8.0")]
721 #[rustc_on_unimplemented = "no implementation for `{Self} <<= {Rhs}`"]
722 pub trait ShlAssign
<Rhs
> {
723 /// Performs the `<<=` operation.
724 #[stable(feature = "op_assign_traits", since = "1.8.0")]
725 fn shl_assign(&mut self, rhs
: Rhs
);
728 macro_rules
! shl_assign_impl
{
730 #[stable(feature = "op_assign_traits", since = "1.8.0")]
731 impl ShlAssign
<$f
> for $t
{
733 #[rustc_inherit_overflow_checks]
734 fn shl_assign(&mut self, other
: $f
) {
739 forward_ref_op_assign
! { impl ShlAssign, shl_assign for $t, $f }
743 macro_rules
! shl_assign_impl_all
{
745 shl_assign_impl
! { $t, u8 }
746 shl_assign_impl
! { $t, u16 }
747 shl_assign_impl
! { $t, u32 }
748 shl_assign_impl
! { $t, u64 }
749 shl_assign_impl
! { $t, u128 }
750 shl_assign_impl
! { $t, usize }
752 shl_assign_impl
! { $t, i8 }
753 shl_assign_impl
! { $t, i16 }
754 shl_assign_impl
! { $t, i32 }
755 shl_assign_impl
! { $t, i64 }
756 shl_assign_impl
! { $t, i128 }
757 shl_assign_impl
! { $t, isize }
761 shl_assign_impl_all
! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
763 /// The right shift assignment operator `>>=`.
767 /// An implementation of `ShrAssign` for a wrapper around `usize`.
770 /// use std::ops::ShrAssign;
772 /// #[derive(Debug, PartialEq)]
773 /// struct Scalar(usize);
775 /// impl ShrAssign<usize> for Scalar {
776 /// fn shr_assign(&mut self, rhs: usize) {
781 /// let mut scalar = Scalar(16);
783 /// assert_eq!(scalar, Scalar(4));
785 #[lang = "shr_assign"]
786 #[stable(feature = "op_assign_traits", since = "1.8.0")]
787 #[rustc_on_unimplemented = "no implementation for `{Self} >>= {Rhs}`"]
788 pub trait ShrAssign
<Rhs
=Self> {
789 /// Performs the `>>=` operation.
790 #[stable(feature = "op_assign_traits", since = "1.8.0")]
791 fn shr_assign(&mut self, rhs
: Rhs
);
794 macro_rules
! shr_assign_impl
{
796 #[stable(feature = "op_assign_traits", since = "1.8.0")]
797 impl ShrAssign
<$f
> for $t
{
799 #[rustc_inherit_overflow_checks]
800 fn shr_assign(&mut self, other
: $f
) {
805 forward_ref_op_assign
! { impl ShrAssign, shr_assign for $t, $f }
809 macro_rules
! shr_assign_impl_all
{
811 shr_assign_impl
! { $t, u8 }
812 shr_assign_impl
! { $t, u16 }
813 shr_assign_impl
! { $t, u32 }
814 shr_assign_impl
! { $t, u64 }
815 shr_assign_impl
! { $t, u128 }
816 shr_assign_impl
! { $t, usize }
818 shr_assign_impl
! { $t, i8 }
819 shr_assign_impl
! { $t, i16 }
820 shr_assign_impl
! { $t, i32 }
821 shr_assign_impl
! { $t, i64 }
822 shr_assign_impl
! { $t, i128 }
823 shr_assign_impl
! { $t, isize }
827 shr_assign_impl_all
! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }