Trait atomic_traits::fetch::And

source ·
pub trait And {
    type Type;

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

Bitwise “and” with the current value.

Required Associated Types§

source

type Type

The underlying type

Required Methods§

source

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

Bitwise “and” with the current value.

Performs a bitwise “and” 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::And::fetch_and(&foo, 0b110011, Ordering::SeqCst), 0b101101);
assert_eq!(Atomic::load(&foo, Ordering::SeqCst), 0b100001);

Implementations on Foreign Types§

source§

impl And for AtomicBool

§

type Type = bool

source§

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

source§

impl And for AtomicI8

§

type Type = i8

source§

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

source§

impl And for AtomicI16

§

type Type = i16

source§

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

source§

impl And for AtomicI32

§

type Type = i32

source§

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

source§

impl And for AtomicI64

§

type Type = i64

source§

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

source§

impl And for AtomicIsize

§

type Type = isize

source§

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

source§

impl And for AtomicU8

§

type Type = u8

source§

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

source§

impl And for AtomicU16

§

type Type = u16

source§

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

source§

impl And for AtomicU32

§

type Type = u32

source§

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

source§

impl And for AtomicU64

§

type Type = u64

source§

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

source§

impl And for AtomicUsize

§

type Type = usize

source§

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

Implementors§