solana_type_overrides/
lib.rs

1///
2/// This lib contains both standard imports and imports shuttle.
3/// Shuttle is a Rust crate that facilitates multithreaded testing. It has its own scheduler
4/// and can efficiently detect bugs in concurrent code. The downside is that we need to replace
5/// all imports by those from Shuttle.
6///
7/// Instead of importing from std, rand, and so on, import the following from solana-type-override,
8/// and include the 'shuttle-test' feature in your crate to use shuttle.
9
10#[cfg(feature = "executor")]
11pub mod executor {
12    #[cfg(not(feature = "shuttle-test"))]
13    pub use futures::executor::*;
14    #[cfg(feature = "shuttle-test")]
15    pub use shuttle::future::*;
16}
17
18pub mod hint {
19    #[cfg(feature = "shuttle-test")]
20    pub use shuttle::hint::*;
21    #[cfg(not(feature = "shuttle-test"))]
22    pub use std::hint::*;
23}
24
25pub mod rand {
26    pub use rand::*;
27    #[cfg(feature = "shuttle-test")]
28    pub use shuttle::rand::{thread_rng, Rng, RngCore};
29}
30
31pub mod sync {
32    #[cfg(feature = "shuttle-test")]
33    pub use shuttle::sync::*;
34    #[cfg(not(feature = "shuttle-test"))]
35    pub use std::sync::*;
36}
37
38pub mod thread {
39    #[cfg(feature = "shuttle-test")]
40    pub use shuttle::thread::*;
41    #[cfg(not(feature = "shuttle-test"))]
42    pub use std::thread::*;
43}