solana_type_overrides/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
///
/// This lib contains both standard imports and imports shuttle.
/// Shuttle is a Rust crate that facilitates multithreaded testing. It has its own scheduler
/// and can efficiently detect bugs in concurrent code. The downside is that we need to replace
/// all imports by those from Shuttle.
///
/// Instead of importing from std, rand, and so on, import the following from solana-type-override,
/// and include the 'shuttle-test' feature in your crate to use shuttle.

#[cfg(feature = "executor")]
pub mod executor {
    #[cfg(not(feature = "shuttle-test"))]
    pub use futures::executor::*;
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::future::*;
}

pub mod hint {
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::hint::*;
    #[cfg(not(feature = "shuttle-test"))]
    pub use std::hint::*;
}

pub mod lazy_static {
    #[cfg(not(feature = "shuttle-test"))]
    pub use lazy_static::*;
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::lazy_static::*;
}

pub mod rand {
    pub use rand::*;
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::rand::{thread_rng, Rng, RngCore};
}

pub mod sync {
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::sync::*;
    #[cfg(not(feature = "shuttle-test"))]
    pub use std::sync::*;
}

pub mod thread {
    #[cfg(feature = "shuttle-test")]
    pub use shuttle::thread::*;
    #[cfg(not(feature = "shuttle-test"))]
    pub use std::thread::*;
}