1 //-
2 // Copyright 2017, 2018 The proptest developers
3 //
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.
9 
10 //! Defines the `Arbitrary` trait and related free functions
11 //! and type aliases.
12 //!
13 //! See the [`Arbitrary`] trait for more information.
14 //!
15 //! [`Arbitrary`]: trait.Arbitrary.html
16 
17 use crate::strategy::statics;
18 use crate::strategy::{Map, Strategy};
19 
20 //==============================================================================
21 // Trait and impls
22 //==============================================================================
23 
24 mod traits;
25 
26 #[macro_use]
27 pub mod functor;
28 
29 #[macro_use]
30 mod macros;
31 
32 mod arrays;
33 mod primitives;
34 mod sample;
35 mod tuples;
36 
37 mod _core;
38 
39 #[cfg(any(feature = "std", feature = "alloc"))]
40 mod _alloc;
41 
42 #[cfg(feature = "std")]
43 mod _std;
44 
45 pub use self::traits::*;
46 
47 //==============================================================================
48 // SMapped + Mapped aliases to make documentation clearer.
49 //==============================================================================
50 
51 pub(crate) type SFnPtrMap<S, O> =
52     statics::Map<S, fn(<S as Strategy>::Value) -> O>;
53 
54 /// A static map from a strategy of `I` to `O`.
55 ///
56 /// # Stability
57 ///
58 /// This is provided to make documentation more readable.
59 /// Do not rely on it existing in your own code.
60 pub type SMapped<I, O> = statics::Map<StrategyFor<I>, fn(I) -> O>;
61 
62 /// A normal map from a strategy of `I` to `O`.
63 ///
64 /// # Stability
65 ///
66 /// This is provided to make documentation more readable.
67 /// Do not rely on it existing in your own code.
68 pub type Mapped<I, O> = Map<StrategyFor<I>, fn(I) -> O>;
69