use core::sync::atomic::Ordering;
pub trait BaseArrayRef {
fn is_null(&self) -> bool;
}
pub trait UnsafeArrayRef: BaseArrayRef {
unsafe fn null_ref() -> Self;
}
pub trait ArrayRef: BaseArrayRef + Clone {
fn clone(ptr: &Self) -> Self {
ptr.clone()
}
fn to_null(&mut self);
fn null_ref() -> Self;
}
pub trait AtomicArrayRef: BaseArrayRef + Sized {
fn compare_and_swap(&self, current: Self, new: Self, order: Ordering) -> Self;
fn compare_exchange(
&self,
current: Self,
new: Self,
success: Ordering,
failure: Ordering,
) -> Result<Self, Self>;
fn compare_exchange_weak(
&self,
current: Self,
new: Self,
success: Ordering,
failure: Ordering,
) -> Result<Self, Self>;
fn load(&self, order: Ordering) -> Self;
fn store(&self, ptr: Self, order: Ordering);
fn swap(&self, ptr: Self, order: Ordering) -> Self;
}