Trait core::ops::BitOrAssign

1.8.0 · source ·
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 });
Run

Required Methods§

source

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);
Run

Implementors§

1.22.0 · source§

impl BitOrAssign<&bool> for bool

1.22.0 · source§

impl BitOrAssign<&i8> for i8

1.22.0 · source§

impl BitOrAssign<&i8> for Saturating<i8>

1.22.0 · source§

impl BitOrAssign<&i8> for Wrapping<i8>

1.22.0 · source§

impl BitOrAssign<&i16> for i16

1.22.0 · source§

impl BitOrAssign<&i16> for Saturating<i16>

1.22.0 · source§

impl BitOrAssign<&i16> for Wrapping<i16>

1.22.0 · source§

impl BitOrAssign<&i32> for i32

1.22.0 · source§

impl BitOrAssign<&i32> for Saturating<i32>

1.22.0 · source§

impl BitOrAssign<&i32> for Wrapping<i32>

1.22.0 · source§

impl BitOrAssign<&i64> for i64

1.22.0 · source§

impl BitOrAssign<&i64> for Saturating<i64>

1.22.0 · source§

impl BitOrAssign<&i64> for Wrapping<i64>

1.22.0 · source§

impl BitOrAssign<&i128> for i128

1.22.0 · source§

impl BitOrAssign<&i128> for Saturating<i128>

1.22.0 · source§

impl BitOrAssign<&i128> for Wrapping<i128>

1.22.0 · source§

impl BitOrAssign<&isize> for isize

1.22.0 · source§

impl BitOrAssign<&isize> for Saturating<isize>

1.22.0 · source§

impl BitOrAssign<&isize> for Wrapping<isize>

1.22.0 · source§

impl BitOrAssign<&u8> for u8

1.22.0 · source§

impl BitOrAssign<&u8> for Saturating<u8>

1.22.0 · source§

impl BitOrAssign<&u8> for Wrapping<u8>

1.22.0 · source§

impl BitOrAssign<&u16> for u16

1.22.0 · source§

impl BitOrAssign<&u16> for Saturating<u16>

1.22.0 · source§

impl BitOrAssign<&u16> for Wrapping<u16>

1.22.0 · source§

impl BitOrAssign<&u32> for u32

1.22.0 · source§

impl BitOrAssign<&u32> for Saturating<u32>

1.22.0 · source§

impl BitOrAssign<&u32> for Wrapping<u32>

1.22.0 · source§

impl BitOrAssign<&u64> for u64

1.22.0 · source§

impl BitOrAssign<&u64> for Saturating<u64>

1.22.0 · source§

impl BitOrAssign<&u64> for Wrapping<u64>

1.22.0 · source§

impl BitOrAssign<&u128> for u128

1.22.0 · source§

impl BitOrAssign<&u128> for Saturating<u128>

1.22.0 · source§

impl BitOrAssign<&u128> for Wrapping<u128>

1.22.0 · source§

impl BitOrAssign<&usize> for usize

1.22.0 · source§

impl BitOrAssign<&usize> for Saturating<usize>

1.22.0 · source§

impl BitOrAssign<&usize> for Wrapping<usize>

1.22.0 · source§

impl BitOrAssign<&Saturating<i8>> for Saturating<i8>

1.22.0 · source§

impl BitOrAssign<&Saturating<i16>> for Saturating<i16>

1.22.0 · source§

impl BitOrAssign<&Saturating<i32>> for Saturating<i32>

1.22.0 · source§

impl BitOrAssign<&Saturating<i64>> for Saturating<i64>

1.22.0 · source§

impl BitOrAssign<&Saturating<i128>> for Saturating<i128>

1.22.0 · source§

impl BitOrAssign<&Saturating<isize>> for Saturating<isize>

1.22.0 · source§

impl BitOrAssign<&Saturating<u8>> for Saturating<u8>

1.22.0 · source§

impl BitOrAssign<&Saturating<u16>> for Saturating<u16>

1.22.0 · source§

impl BitOrAssign<&Saturating<u32>> for Saturating<u32>

1.22.0 · source§

impl BitOrAssign<&Saturating<u64>> for Saturating<u64>

1.22.0 · source§

impl BitOrAssign<&Saturating<u128>> for Saturating<u128>

1.22.0 · source§

impl BitOrAssign<&Saturating<usize>> for Saturating<usize>

1.22.0 · source§

impl BitOrAssign<&Wrapping<i8>> for Wrapping<i8>

1.22.0 · source§

impl BitOrAssign<&Wrapping<i16>> for Wrapping<i16>

1.22.0 · source§

impl BitOrAssign<&Wrapping<i32>> for Wrapping<i32>

1.22.0 · source§

impl BitOrAssign<&Wrapping<i64>> for Wrapping<i64>

1.22.0 · source§

impl BitOrAssign<&Wrapping<i128>> for Wrapping<i128>

1.22.0 · source§

impl BitOrAssign<&Wrapping<isize>> for Wrapping<isize>

1.22.0 · source§

impl BitOrAssign<&Wrapping<u8>> for Wrapping<u8>

1.22.0 · source§

impl BitOrAssign<&Wrapping<u16>> for Wrapping<u16>

1.22.0 · source§

impl BitOrAssign<&Wrapping<u32>> for Wrapping<u32>

1.22.0 · source§

impl BitOrAssign<&Wrapping<u64>> for Wrapping<u64>

1.22.0 · source§

impl BitOrAssign<&Wrapping<u128>> for Wrapping<u128>

1.22.0 · source§

impl BitOrAssign<&Wrapping<usize>> for Wrapping<usize>

source§

impl BitOrAssign<bool> for bool

source§

impl BitOrAssign<i8> for i8

1.45.0 · source§

impl BitOrAssign<i8> for NonZeroI8

1.75.0-dev · source§

impl BitOrAssign<i8> for Saturating<i8>

1.60.0 · source§

impl BitOrAssign<i8> for Wrapping<i8>

source§

impl BitOrAssign<i16> for i16

1.45.0 · source§

impl BitOrAssign<i16> for NonZeroI16

1.75.0-dev · source§

impl BitOrAssign<i16> for Saturating<i16>

1.60.0 · source§

impl BitOrAssign<i16> for Wrapping<i16>

source§

impl BitOrAssign<i32> for i32

1.45.0 · source§

impl BitOrAssign<i32> for NonZeroI32

1.75.0-dev · source§

impl BitOrAssign<i32> for Saturating<i32>

1.60.0 · source§

impl BitOrAssign<i32> for Wrapping<i32>

source§

impl BitOrAssign<i64> for i64

1.45.0 · source§

impl BitOrAssign<i64> for NonZeroI64

1.75.0-dev · source§

impl BitOrAssign<i64> for Saturating<i64>

1.60.0 · source§

impl BitOrAssign<i64> for Wrapping<i64>

source§

impl BitOrAssign<i128> for i128

1.45.0 · source§

impl BitOrAssign<i128> for NonZeroI128

1.75.0-dev · source§

impl BitOrAssign<i128> for Saturating<i128>

1.60.0 · source§

impl BitOrAssign<i128> for Wrapping<i128>

source§

impl BitOrAssign<isize> for isize

1.45.0 · source§

impl BitOrAssign<isize> for NonZeroIsize

1.75.0-dev · source§

impl BitOrAssign<isize> for Saturating<isize>

1.60.0 · source§

impl BitOrAssign<isize> for Wrapping<isize>

source§

impl BitOrAssign<u8> for u8

1.45.0 · source§

impl BitOrAssign<u8> for NonZeroU8

1.75.0-dev · source§

impl BitOrAssign<u8> for Saturating<u8>

1.60.0 · source§

impl BitOrAssign<u8> for Wrapping<u8>

source§

impl BitOrAssign<u16> for u16

1.45.0 · source§

impl BitOrAssign<u16> for NonZeroU16

1.75.0-dev · source§

impl BitOrAssign<u16> for Saturating<u16>

1.60.0 · source§

impl BitOrAssign<u16> for Wrapping<u16>

source§

impl BitOrAssign<u32> for u32

1.45.0 · source§

impl BitOrAssign<u32> for NonZeroU32

1.75.0-dev · source§

impl BitOrAssign<u32> for Saturating<u32>

1.60.0 · source§

impl BitOrAssign<u32> for Wrapping<u32>

source§

impl BitOrAssign<u64> for u64

1.45.0 · source§

impl BitOrAssign<u64> for NonZeroU64

1.75.0-dev · source§

impl BitOrAssign<u64> for Saturating<u64>

1.60.0 · source§

impl BitOrAssign<u64> for Wrapping<u64>

source§

impl BitOrAssign<u128> for u128

1.45.0 · source§

impl BitOrAssign<u128> for NonZeroU128

1.75.0-dev · source§

impl BitOrAssign<u128> for Saturating<u128>

1.60.0 · source§

impl BitOrAssign<u128> for Wrapping<u128>

source§

impl BitOrAssign<usize> for usize

1.45.0 · source§

impl BitOrAssign<usize> for NonZeroUsize

1.75.0-dev · source§

impl BitOrAssign<usize> for Saturating<usize>

1.60.0 · source§

impl BitOrAssign<usize> for Wrapping<usize>

1.45.0 · source§

impl BitOrAssign<NonZeroI8> for NonZeroI8

1.45.0 · source§

impl BitOrAssign<NonZeroI16> for NonZeroI16

1.45.0 · source§

impl BitOrAssign<NonZeroI32> for NonZeroI32

1.45.0 · source§

impl BitOrAssign<NonZeroI64> for NonZeroI64

1.45.0 · source§

impl BitOrAssign<NonZeroI128> for NonZeroI128

1.45.0 · source§

impl BitOrAssign<NonZeroIsize> for NonZeroIsize

1.45.0 · source§

impl BitOrAssign<NonZeroU8> for NonZeroU8

1.45.0 · source§

impl BitOrAssign<NonZeroU16> for NonZeroU16

1.45.0 · source§

impl BitOrAssign<NonZeroU32> for NonZeroU32

1.45.0 · source§

impl BitOrAssign<NonZeroU64> for NonZeroU64

1.45.0 · source§

impl BitOrAssign<NonZeroU128> for NonZeroU128

1.45.0 · source§

impl BitOrAssign<NonZeroUsize> for NonZeroUsize

1.75.0-dev · source§

impl BitOrAssign<Saturating<i8>> for Saturating<i8>

1.75.0-dev · source§

impl BitOrAssign<Saturating<i16>> for Saturating<i16>

1.75.0-dev · source§

impl BitOrAssign<Saturating<i32>> for Saturating<i32>

1.75.0-dev · source§

impl BitOrAssign<Saturating<i64>> for Saturating<i64>

1.75.0-dev · source§

impl BitOrAssign<Saturating<i128>> for Saturating<i128>

1.75.0-dev · source§

impl BitOrAssign<Saturating<isize>> for Saturating<isize>

1.75.0-dev · source§

impl BitOrAssign<Saturating<u8>> for Saturating<u8>

1.75.0-dev · source§

impl BitOrAssign<Saturating<u16>> for Saturating<u16>

1.75.0-dev · source§

impl BitOrAssign<Saturating<u32>> for Saturating<u32>

1.75.0-dev · source§

impl BitOrAssign<Saturating<u64>> for Saturating<u64>

1.75.0-dev · source§

impl BitOrAssign<Saturating<u128>> for Saturating<u128>

1.75.0-dev · source§

impl BitOrAssign<Saturating<usize>> for Saturating<usize>

source§

impl BitOrAssign<Wrapping<i8>> for Wrapping<i8>

source§

impl BitOrAssign<Wrapping<i16>> for Wrapping<i16>

source§

impl BitOrAssign<Wrapping<i32>> for Wrapping<i32>

source§

impl BitOrAssign<Wrapping<i64>> for Wrapping<i64>

source§

impl BitOrAssign<Wrapping<i128>> for Wrapping<i128>

source§

impl BitOrAssign<Wrapping<isize>> for Wrapping<isize>

source§

impl BitOrAssign<Wrapping<u8>> for Wrapping<u8>

source§

impl BitOrAssign<Wrapping<u16>> for Wrapping<u16>

source§

impl BitOrAssign<Wrapping<u32>> for Wrapping<u32>

source§

impl BitOrAssign<Wrapping<u64>> for Wrapping<u64>

source§

impl BitOrAssign<Wrapping<u128>> for Wrapping<u128>

source§

impl BitOrAssign<Wrapping<usize>> for Wrapping<usize>

source§

impl<T, U, const LANES: usize> BitOrAssign<U> for Simd<T, LANES>where Self: BitOr<U, Output = Self>, T: SimdElement, LaneCount<LANES>: SupportedLaneCount,

source§

impl<T, const LANES: usize> BitOrAssign<bool> for Mask<T, LANES>where T: MaskElement, LaneCount<LANES>: SupportedLaneCount,

source§

impl<T, const LANES: usize> BitOrAssign<Mask<T, LANES>> for Mask<T, LANES>where T: MaskElement, LaneCount<LANES>: SupportedLaneCount,