arbitrary/foreign/core/sync/
atomic.rs

1use {
2    crate::{Arbitrary, Result, Unstructured},
3    core::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize},
4};
5
6impl<'a> Arbitrary<'a> for AtomicBool {
7    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
8        Arbitrary::arbitrary(u).map(Self::new)
9    }
10
11    #[inline]
12    fn size_hint(depth: usize) -> (usize, Option<usize>) {
13        <bool as Arbitrary<'a>>::size_hint(depth)
14    }
15}
16
17impl<'a> Arbitrary<'a> for AtomicIsize {
18    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
19        Arbitrary::arbitrary(u).map(Self::new)
20    }
21
22    #[inline]
23    fn size_hint(depth: usize) -> (usize, Option<usize>) {
24        <isize as Arbitrary<'a>>::size_hint(depth)
25    }
26}
27
28impl<'a> Arbitrary<'a> for AtomicUsize {
29    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
30        Arbitrary::arbitrary(u).map(Self::new)
31    }
32
33    #[inline]
34    fn size_hint(depth: usize) -> (usize, Option<usize>) {
35        <usize as Arbitrary<'a>>::size_hint(depth)
36    }
37}