use core::sync::atomic::Ordering;
pub trait And {
type Type;
fn fetch_and(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
#[cfg(any(feature = "atomic_nand", feature = "since_1_27_0"))]
pub trait Nand {
type Type;
fn fetch_nand(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
pub trait Or {
type Type;
fn fetch_or(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
pub trait Xor {
type Type;
fn fetch_xor(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
#[cfg(feature = "atomic_bool_fetch_not")]
pub trait Not {
type Type;
fn fetch_not(&self, order: Ordering) -> Self::Type;
}
pub trait Add {
type Type;
fn fetch_add(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
pub trait Sub {
type Type;
fn fetch_sub(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
cfg_if! {
if #[cfg(any(feature = "since_1_45_0"))] {
pub trait Update {
type Type;
fn fetch_update<F>(
&self,
fetch_order: Ordering,
set_order: Ordering,
f: F,
) -> Result<Self::Type, Self::Type>
where
F: FnMut(Self::Type) -> Option<Self::Type>;
}
pub trait Max {
type Type;
fn fetch_max(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
pub trait Min {
type Type;
fn fetch_min(&self, val: Self::Type, order: Ordering) -> Self::Type;
}
}
}