use super::*;
#[derive(Clone, Debug, Default)]
pub struct AtomicBool {
inner: Bool,
}
pub fn atomic_bool() -> AtomicBool {
AtomicBool {
inner: Bool { _private: () },
}
}
impl Mutate<core::sync::atomic::AtomicBool> for AtomicBool {
#[inline]
fn mutate(
&mut self,
c: &mut Candidates,
value: &mut core::sync::atomic::AtomicBool,
) -> Result<()> {
self.inner.mutate(c, value.get_mut())
}
#[inline]
fn mutation_count(
&self,
value: &core::sync::atomic::AtomicBool,
shrink: bool,
) -> core::option::Option<u32> {
let v = value.load(core::sync::atomic::Ordering::Relaxed);
self.inner.mutation_count(&v, shrink)
}
}
impl Generate<core::sync::atomic::AtomicBool> for AtomicBool {
#[inline]
fn generate(&mut self, ctx: &mut Context) -> Result<core::sync::atomic::AtomicBool> {
Ok(core::sync::atomic::AtomicBool::new(
self.inner.generate(ctx)?,
))
}
}
impl DefaultMutate for core::sync::atomic::AtomicBool {
type DefaultMutate = AtomicBool;
}
#[derive(Clone, Debug, Default)]
pub struct AtomicIsize {
inner: Isize,
}
pub fn atomic_isize() -> AtomicIsize {
AtomicIsize {
inner: Isize { _private: () },
}
}
impl Mutate<core::sync::atomic::AtomicIsize> for AtomicIsize {
#[inline]
fn mutate(
&mut self,
c: &mut Candidates,
value: &mut core::sync::atomic::AtomicIsize,
) -> Result<()> {
self.inner.mutate(c, value.get_mut())
}
#[inline]
fn mutation_count(
&self,
value: &core::sync::atomic::AtomicIsize,
shrink: bool,
) -> core::option::Option<u32> {
let v = value.load(core::sync::atomic::Ordering::Relaxed);
self.inner.mutation_count(&v, shrink)
}
}
impl Generate<core::sync::atomic::AtomicIsize> for AtomicIsize {
#[inline]
fn generate(&mut self, ctx: &mut Context) -> Result<core::sync::atomic::AtomicIsize> {
Ok(core::sync::atomic::AtomicIsize::new(
self.inner.generate(ctx)?,
))
}
}
impl DefaultMutate for core::sync::atomic::AtomicIsize {
type DefaultMutate = AtomicIsize;
}
#[derive(Clone, Debug, Default)]
pub struct AtomicUsize {
inner: Usize,
}
pub fn atomic_usize() -> AtomicUsize {
AtomicUsize {
inner: Usize { _private: () },
}
}
impl Mutate<core::sync::atomic::AtomicUsize> for AtomicUsize {
#[inline]
fn mutate(
&mut self,
c: &mut Candidates,
value: &mut core::sync::atomic::AtomicUsize,
) -> Result<()> {
self.inner.mutate(c, value.get_mut())
}
#[inline]
fn mutation_count(
&self,
value: &core::sync::atomic::AtomicUsize,
shrink: bool,
) -> core::option::Option<u32> {
let v = value.load(core::sync::atomic::Ordering::Relaxed);
self.inner.mutation_count(&v, shrink)
}
}
impl Generate<core::sync::atomic::AtomicUsize> for AtomicUsize {
#[inline]
fn generate(&mut self, ctx: &mut Context) -> Result<core::sync::atomic::AtomicUsize> {
Ok(core::sync::atomic::AtomicUsize::new(
self.inner.generate(ctx)?,
))
}
}
impl DefaultMutate for core::sync::atomic::AtomicUsize {
type DefaultMutate = AtomicUsize;
}