pub trait Or {
type Type;
// Required method
fn fetch_or(&self, val: Self::Type, order: Ordering) -> Self::Type;
}Expand description
Bitwise “or” with the current value.
Required Associated Types§
Required Methods§
Sourcefn fetch_or(&self, val: Self::Type, order: Ordering) -> Self::Type
fn fetch_or(&self, val: Self::Type, order: Ordering) -> Self::Type
Bitwise “or” with the current value.
Performs a bitwise “or” operation on the current value and the argument val,
and sets the new value to the result.
Returns the previous value.
§Examples
use std::sync::atomic::{AtomicU8, Ordering};
use atomic_traits::{Atomic, fetch};
let foo = AtomicU8::new(0b101101);
assert_eq!(fetch::Or::fetch_or(&foo, 0b110011, Ordering::SeqCst), 0b101101);
assert_eq!(Atomic::load(&foo, Ordering::SeqCst), 0b111111);