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 lazy_static {
26    #[cfg(not(feature = "shuttle-test"))]
27    pub use lazy_static::*;
28    #[cfg(feature = "shuttle-test")]
29    pub use shuttle::lazy_static::*;
30}
31
32pub mod rand {
33    pub use rand::*;
34    #[cfg(feature = "shuttle-test")]
35    pub use shuttle::rand::{thread_rng, Rng, RngCore};
36}
37
38pub mod sync {
39    #[cfg(feature = "shuttle-test")]
40    pub use shuttle::sync::*;
41    #[cfg(not(feature = "shuttle-test"))]
42    pub use std::sync::*;
43}
44
45pub mod thread {
46    #[cfg(feature = "shuttle-test")]
47    pub use shuttle::thread::*;
48    #[cfg(not(feature = "shuttle-test"))]
49    pub use std::thread::*;
50}