]>
git.proxmox.com Git - cargo.git/blob - vendor/proptest/src/arbitrary/_alloc/sync.rs
2 // Copyright 2017, 2018 The proptest developers
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 //! Arbitrary implementations for `std::sync`.
12 use crate::std_facade
::Arc
;
13 use core
::sync
::atomic
::*;
15 use crate::arbitrary
::*;
16 use crate::strategy
::statics
::static_map
;
17 use crate::strategy
::*;
22 ($
($
type: ident
, $base
: ty
);+) => {
23 $
(arbitrary
!($
type, SMapped
<$base
, Self>;
24 static_map(any
::<$base
>(), $
type::new
)
29 // impl_wrap_gen!(AtomicPtr); // We don't have impl Arbitrary for *mut T yet.
30 atomic
!(AtomicBool
, bool
; AtomicIsize
, isize; AtomicUsize
, usize);
32 #[cfg(feature = "unstable")]
33 atomic
!(AtomicI8
, i8; AtomicI16
, i16; AtomicI32
, i32;
34 AtomicU8
, u8; AtomicU16
, u16; AtomicU32
, u32);
36 #[cfg(all(feature = "unstable", feature = "atomic64bit"))]
37 atomic
!(AtomicI64
, i64; AtomicU64
, u64);
40 LazyTupleUnion
<(WA
<Just
<Self>>, WA
<Just
<Self>>, WA
<Just
<Self>>,
41 WA
<Just
<Self>>, WA
<Just
<Self>>)>;
43 Just(Ordering
::Relaxed
),
44 Just(Ordering
::Release
),
45 Just(Ordering
::Acquire
),
46 Just(Ordering
::AcqRel
),
47 Just(Ordering
::SeqCst
)
55 atomic_bool
=> AtomicBool
,
56 atomic_isize
=> AtomicIsize
,
57 atomic_usize
=> AtomicUsize
,
61 #[cfg(feature = "unstable")]
63 atomic_i8
=> AtomicI8
,
64 atomic_i16
=> AtomicI16
,
65 atomic_i32
=> AtomicI32
,
66 atomic_u8
=> AtomicU8
,
67 atomic_u16
=> AtomicU16
,
68 atomic_u32
=> AtomicU32
71 #[cfg(all(feature = "unstable", feature = "atomic64bit"))]
73 atomic_i64
=> AtomicI64
,
74 atomic_u64
=> AtomicU64