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