solana_svm_type_overrides/
lib.rs

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