Xor

Trait Xor 

Source
pub trait Xor {
    type Type;

    // Required method
    fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
Expand description

Bitwise “xor” with the current value.

Required Associated Types§

Source

type Type

The underlying type

Required Methods§

Source

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Bitwise “xor” with the current value.

Performs a bitwise “xor” 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::Xor::fetch_xor(&foo, 0b110011, Ordering::SeqCst), 0b101101);
assert_eq!(Atomic::load(&foo, Ordering::SeqCst), 0b011110);

Implementations on Foreign Types§

Source§

impl Xor for AtomicBool

Source§

type Type = bool

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicI8

Source§

type Type = i8

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicI16

Source§

type Type = i16

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicI32

Source§

type Type = i32

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicI64

Source§

type Type = i64

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicIsize

Source§

type Type = isize

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicU8

Source§

type Type = u8

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicU16

Source§

type Type = u16

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicU32

Source§

type Type = u32

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicU64

Source§

type Type = u64

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Source§

impl Xor for AtomicUsize

Source§

type Type = usize

Source§

fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type

Implementors§