solana_svm_type_overrides/
lib.rs

1#![cfg_attr(
2    not(feature = "agave-unstable-api"),
3    deprecated(
4        since = "3.1.0",
5        note = "This crate has been marked for formal inclusion in the Agave Unstable API. From \
6                v4.0.0 onward, the `agave-unstable-api` crate feature must be specified to \
7                acknowledge use of an interface that may break without warning."
8    )
9)]
10//! This lib contains both standard imports and imports shuttle.
11//! Shuttle is a Rust crate that facilitates multithreaded testing. It has its own scheduler
12//! and can efficiently detect bugs in concurrent code. The downside is that we need to replace
13//! all imports by those from Shuttle.
14//!
15//! Instead of importing from std, rand, and so on, import the following from solana-type-override,
16//! and include the 'shuttle-test' feature in your crate to use shuttle.
17
18#[cfg(feature = "executor")]
19pub mod executor {
20    #[cfg(not(feature = "shuttle-test"))]
21    pub use futures::executor::*;
22    #[cfg(feature = "shuttle-test")]
23    pub use shuttle::future::*;
24}
25
26pub mod hint {
27    #[cfg(feature = "shuttle-test")]
28    pub use shuttle::hint::*;
29    #[cfg(not(feature = "shuttle-test"))]
30    pub use std::hint::*;
31}
32
33pub mod rand {
34    pub use rand::*;
35    #[cfg(feature = "shuttle-test")]
36    pub use shuttle::rand::{thread_rng, Rng, RngCore};
37}
38
39pub mod sync {
40    #[cfg(feature = "shuttle-test")]
41    pub use shuttle::sync::*;
42    #[cfg(not(feature = "shuttle-test"))]
43    pub use std::sync::*;
44}
45
46pub mod thread {
47    #[cfg(feature = "shuttle-test")]
48    pub use shuttle::thread::*;
49    #[cfg(not(feature = "shuttle-test"))]
50    pub use std::thread::*;
51}