pub trait BitOrAssign<Rhs = Self> {
// Required method
fn bitor_assign(&mut self, rhs: Rhs);
}
Expand description
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§
1.8.0 · Sourcefn bitor_assign(&mut self, rhs: Rhs)
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 for bool
impl BitOrAssign for i8
impl BitOrAssign for i16
impl BitOrAssign for i32
impl BitOrAssign for i64
impl BitOrAssign for i128
impl BitOrAssign for isize
impl BitOrAssign for u8
impl BitOrAssign for u16
impl BitOrAssign for u32
impl BitOrAssign for u64
impl BitOrAssign for u128
impl BitOrAssign for usize
impl BitOrAssign for Ipv4Addr
impl BitOrAssign for Ipv6Addr
impl BitOrAssign for Saturating<i8>
impl BitOrAssign for Saturating<i16>
impl BitOrAssign for Saturating<i32>
impl BitOrAssign for Saturating<i64>
impl BitOrAssign for Saturating<i128>
impl BitOrAssign for Saturating<isize>
impl BitOrAssign for Saturating<u8>
impl BitOrAssign for Saturating<u16>
impl BitOrAssign for Saturating<u32>
impl BitOrAssign for Saturating<u64>
impl BitOrAssign for Saturating<u128>
impl BitOrAssign for Saturating<usize>
impl BitOrAssign for Wrapping<i8>
impl BitOrAssign for Wrapping<i16>
impl BitOrAssign for Wrapping<i32>
impl BitOrAssign for Wrapping<i64>
impl BitOrAssign for Wrapping<i128>
impl BitOrAssign for Wrapping<isize>
impl BitOrAssign for Wrapping<u8>
impl BitOrAssign for Wrapping<u16>
impl BitOrAssign for Wrapping<u32>
impl BitOrAssign for Wrapping<u64>
impl BitOrAssign for Wrapping<u128>
impl BitOrAssign for Wrapping<usize>
impl BitOrAssign for Effects
§Examples
let mut effects = anstyle::Effects::BOLD;
effects |= anstyle::Effects::UNDERLINE;
assert_eq!(format!("{:?}", effects), "Effects(BOLD | UNDERLINE)");
impl BitOrAssign for colored::style::Style
impl BitOrAssign for mio::interest::Interest
impl BitOrAssign for StaticVarApiFlags
impl BitOrAssign for Access
impl BitOrAssign for AtFlags
impl BitOrAssign for CloneFlags
impl BitOrAssign for CopyfileFlags
impl BitOrAssign for FallocateFlags
impl BitOrAssign for Mode
impl BitOrAssign for OFlags
impl BitOrAssign for StatVfsMountFlags
impl BitOrAssign for DupFlags
impl BitOrAssign for FdFlags
impl BitOrAssign for XattrFlags
impl BitOrAssign for security_framework::authorization::Flags
impl BitOrAssign for security_framework::os::macos::code_signing::Flags
impl BitOrAssign for AccessControlOptions
impl BitOrAssign for RevocationPolicy
impl BitOrAssign for TrustOptions
impl BitOrAssign for Choice
impl BitOrAssign for tokio::io::interest::Interest
impl BitOrAssign for Ready
impl BitOrAssign for WasmFeatures
impl BitOrAssign for SegmentFlags
impl BitOrAssign for SymbolFlags
impl BitOrAssign for LengthHint
impl BitOrAssign for CodeMetadata
impl BitOrAssign for EsdtLocalRoleFlags
impl BitOrAssign for BigInt
impl BitOrAssign for multiversx_sc_snippets::imports::RustBigUint
impl BitOrAssign<&Styles> for colored::style::Style
impl BitOrAssign<&bool> for bool
impl BitOrAssign<&i8> for i8
impl BitOrAssign<&i8> for Saturating<i8>
impl BitOrAssign<&i8> for Wrapping<i8>
impl BitOrAssign<&i16> for i16
impl BitOrAssign<&i16> for Saturating<i16>
impl BitOrAssign<&i16> for Wrapping<i16>
impl BitOrAssign<&i32> for i32
impl BitOrAssign<&i32> for Saturating<i32>
impl BitOrAssign<&i32> for Wrapping<i32>
impl BitOrAssign<&i64> for i64
impl BitOrAssign<&i64> for Saturating<i64>
impl BitOrAssign<&i64> for Wrapping<i64>
impl BitOrAssign<&i128> for i128
impl BitOrAssign<&i128> for Saturating<i128>
impl BitOrAssign<&i128> for Wrapping<i128>
impl BitOrAssign<&isize> for isize
impl BitOrAssign<&isize> for Saturating<isize>
impl BitOrAssign<&isize> for Wrapping<isize>
impl BitOrAssign<&u8> for u8
impl BitOrAssign<&u8> for Saturating<u8>
impl BitOrAssign<&u8> for Wrapping<u8>
impl BitOrAssign<&u16> for u16
impl BitOrAssign<&u16> for Saturating<u16>
impl BitOrAssign<&u16> for Wrapping<u16>
impl BitOrAssign<&u32> for u32
impl BitOrAssign<&u32> for Saturating<u32>
impl BitOrAssign<&u32> for Wrapping<u32>
impl BitOrAssign<&u64> for u64
impl BitOrAssign<&u64> for Saturating<u64>
impl BitOrAssign<&u64> for Wrapping<u64>
impl BitOrAssign<&u128> for u128
impl BitOrAssign<&u128> for Saturating<u128>
impl BitOrAssign<&u128> for Wrapping<u128>
impl BitOrAssign<&usize> for usize
impl BitOrAssign<&usize> for Saturating<usize>
impl BitOrAssign<&usize> for Wrapping<usize>
impl BitOrAssign<&Ipv4Addr> for Ipv4Addr
impl BitOrAssign<&Ipv6Addr> for Ipv6Addr
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>
impl BitOrAssign<&Style> for colored::style::Style
impl BitOrAssign<&BigInt> for BigInt
impl BitOrAssign<&BigUint> for multiversx_sc_snippets::imports::RustBigUint
impl BitOrAssign<Styles> for colored::style::Style
impl BitOrAssign<i8> for Saturating<i8>
impl BitOrAssign<i8> for Wrapping<i8>
impl BitOrAssign<i16> for Saturating<i16>
impl BitOrAssign<i16> for Wrapping<i16>
impl BitOrAssign<i32> for Saturating<i32>
impl BitOrAssign<i32> for Wrapping<i32>
impl BitOrAssign<i64> for Saturating<i64>
impl BitOrAssign<i64> for Wrapping<i64>
impl BitOrAssign<i128> for Saturating<i128>
impl BitOrAssign<i128> for Wrapping<i128>
impl BitOrAssign<isize> for Saturating<isize>
impl BitOrAssign<isize> for Wrapping<isize>
impl BitOrAssign<u8> for Saturating<u8>
impl BitOrAssign<u8> for Wrapping<u8>
impl BitOrAssign<u16> for Saturating<u16>
impl BitOrAssign<u16> for Wrapping<u16>
impl BitOrAssign<u32> for Saturating<u32>
impl BitOrAssign<u32> for Wrapping<u32>
impl BitOrAssign<u64> for Saturating<u64>
impl BitOrAssign<u64> for Wrapping<u64>
impl BitOrAssign<u128> for Saturating<u128>
impl BitOrAssign<u128> for Wrapping<u128>
impl BitOrAssign<usize> for Saturating<usize>
impl BitOrAssign<usize> for Wrapping<usize>
impl BitOrAssign<Effects> for anstyle::style::Style
§Examples
let mut style = anstyle::Style::new();
style |= anstyle::Effects::BOLD.into();