Trait std::ops::BitOrAssign
pub trait BitOrAssign<Rhs = Self> { fn bitor_assign(&mut self, rhs: Rhs); }
The bitwise OR assignment operator |=
.
Examples
use std::ops::BitOrAssign; #[derive(Debug, PartialEq)] struct PersonalPreferences { likes_cats: bool, likes_dogs: bool, } impl BitOrAssign for PersonalPreferences { fn bitor_assign(&mut self, rhs: Self) { self.likes_cats |= rhs.likes_cats; self.likes_dogs |= rhs.likes_dogs; } } let mut prefs = PersonalPreferences { likes_cats: true, likes_dogs: false }; prefs |= PersonalPreferences { likes_cats: false, likes_dogs: true }; assert_eq!(prefs, PersonalPreferences { likes_cats: true, likes_dogs: true });
Required methods
fn bitor_assign(&mut self, rhs: Rhs)
Performs the |=
operation.
Examples
let mut x = true; x |= false; assert_eq!(x, true); let mut x = false; x |= false; assert_eq!(x, false); let mut x: u8 = 5; x |= 1; assert_eq!(x, 5); let mut x: u8 = 5; x |= 2; assert_eq!(x, 7);
Implementors
impl BitOrAssign<bool> for bool
impl BitOrAssign<i8> for i8
[src]1.45.0
impl BitOrAssign<i8> for NonZeroI8
impl BitOrAssign<i16> for i16
[src]1.45.0
impl BitOrAssign<i16> for NonZeroI16
impl BitOrAssign<i32> for i32
[src]1.45.0
impl BitOrAssign<i32> for NonZeroI32
impl BitOrAssign<i64> for i64
[src]1.45.0
impl BitOrAssign<i64> for NonZeroI64
impl BitOrAssign<i128> for i128
[src]1.45.0
impl BitOrAssign<i128> for NonZeroI128
impl BitOrAssign<isize> for isize
[src]1.45.0
impl BitOrAssign<isize> for NonZeroIsize
impl BitOrAssign<u8> for u8
[src]1.45.0
impl BitOrAssign<u8> for NonZeroU8
impl BitOrAssign<u16> for u16
[src]1.45.0
impl BitOrAssign<u16> for NonZeroU16
impl BitOrAssign<u32> for u32
[src]1.45.0
impl BitOrAssign<u32> for NonZeroU32
impl BitOrAssign<u64> for u64
[src]1.45.0
impl BitOrAssign<u64> for NonZeroU64
impl BitOrAssign<u128> for u128
[src]1.45.0
impl BitOrAssign<u128> for NonZeroU128
impl BitOrAssign<usize> for usize
[src]1.45.0
impl BitOrAssign<usize> for NonZeroUsize
[src]1.45.0
impl BitOrAssign<NonZeroI8> for NonZeroI8
[src]1.45.0
impl BitOrAssign<NonZeroI16> for NonZeroI16
[src]1.45.0
impl BitOrAssign<NonZeroI32> for NonZeroI32
[src]1.45.0
impl BitOrAssign<NonZeroI64> for NonZeroI64
[src]1.45.0
impl BitOrAssign<NonZeroI128> for NonZeroI128
[src]1.45.0
impl BitOrAssign<NonZeroIsize> for NonZeroIsize
[src]1.45.0
impl BitOrAssign<NonZeroU8> for NonZeroU8
[src]1.45.0
impl BitOrAssign<NonZeroU16> for NonZeroU16
[src]1.45.0
impl BitOrAssign<NonZeroU32> for NonZeroU32
[src]1.45.0
impl BitOrAssign<NonZeroU64> for NonZeroU64
[src]1.45.0
impl BitOrAssign<NonZeroU128> for NonZeroU128
[src]1.45.0
impl BitOrAssign<NonZeroUsize> for NonZeroUsize
impl BitOrAssign<Saturating<i8>> for Saturating<i8>
impl BitOrAssign<Saturating<i16>> for Saturating<i16>
impl BitOrAssign<Saturating<i32>> for Saturating<i32>
impl BitOrAssign<Saturating<i64>> for Saturating<i64>
impl BitOrAssign<Saturating<i128>> for Saturating<i128>
impl BitOrAssign<Saturating<isize>> for Saturating<isize>
impl BitOrAssign<Saturating<u8>> for Saturating<u8>
impl BitOrAssign<Saturating<u16>> for Saturating<u16>
impl BitOrAssign<Saturating<u32>> for Saturating<u32>
impl BitOrAssign<Saturating<u64>> for Saturating<u64>
impl BitOrAssign<Saturating<u128>> for Saturating<u128>
impl BitOrAssign<Saturating<usize>> for Saturating<usize>
impl BitOrAssign<Wrapping<i8>> for Wrapping<i8>
impl BitOrAssign<Wrapping<i16>> for Wrapping<i16>
impl BitOrAssign<Wrapping<i32>> for Wrapping<i32>
impl BitOrAssign<Wrapping<i64>> for Wrapping<i64>
impl BitOrAssign<Wrapping<i128>> for Wrapping<i128>
impl BitOrAssign<Wrapping<isize>> for Wrapping<isize>
impl BitOrAssign<Wrapping<u8>> for Wrapping<u8>
impl BitOrAssign<Wrapping<u16>> for Wrapping<u16>
impl BitOrAssign<Wrapping<u32>> for Wrapping<u32>
impl BitOrAssign<Wrapping<u64>> for Wrapping<u64>
impl BitOrAssign<Wrapping<u128>> for Wrapping<u128>
impl BitOrAssign<Wrapping<usize>> for Wrapping<usize>
[src]1.22.0
impl<'_> BitOrAssign<&'_ bool> for bool
[src]1.22.0
impl<'_> BitOrAssign<&'_ i8> for i8
[src]1.22.0
impl<'_> BitOrAssign<&'_ i16> for i16
[src]1.22.0
impl<'_> BitOrAssign<&'_ i32> for i32
[src]1.22.0
impl<'_> BitOrAssign<&'_ i64> for i64
[src]1.22.0
impl<'_> BitOrAssign<&'_ i128> for i128
[src]1.22.0
impl<'_> BitOrAssign<&'_ isize> for isize
[src]1.22.0
impl<'_> BitOrAssign<&'_ u8> for u8
[src]1.22.0
impl<'_> BitOrAssign<&'_ u16> for u16
[src]1.22.0
impl<'_> BitOrAssign<&'_ u32> for u32
[src]1.22.0
impl<'_> BitOrAssign<&'_ u64> for u64
[src]1.22.0
impl<'_> BitOrAssign<&'_ u128> for u128
[src]1.22.0
impl<'_> BitOrAssign<&'_ usize> for usize
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<i8>> for Saturating<i8>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<i16>> for Saturating<i16>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<i32>> for Saturating<i32>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<i64>> for Saturating<i64>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<i128>> for Saturating<i128>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<isize>> for Saturating<isize>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<u8>> for Saturating<u8>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<u16>> for Saturating<u16>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<u32>> for Saturating<u32>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<u64>> for Saturating<u64>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<u128>> for Saturating<u128>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Saturating<usize>> for Saturating<usize>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<i8>> for Wrapping<i8>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<i16>> for Wrapping<i16>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<i32>> for Wrapping<i32>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<i64>> for Wrapping<i64>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<i128>> for Wrapping<i128>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<isize>> for Wrapping<isize>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<u8>> for Wrapping<u8>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<u16>> for Wrapping<u16>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<u32>> for Wrapping<u32>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<u64>> for Wrapping<u64>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<u128>> for Wrapping<u128>
[src]1.22.0
impl<'_> BitOrAssign<&'_ Wrapping<usize>> for Wrapping<usize>
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ops/trait.BitOrAssign.html