Skip to main content

shuttle_rand/
lib.rs

1//! This crate provides a Shuttle-compatible implementation and wrapper for [`rand` version 0.8] in order to make it
2//! more ergonomic to run a codebase under Shuttle.
3//!
4//! [`rand` version 0.8]: <https://crates.io/crates/rand/0.8.6>
5//!
6//! To use this crate, add something akin to the following to your Cargo.toml:
7//!
8//! ```ignore
9//! [features]
10//! shuttle = [
11//!    "rand/shuttle",
12//! ]
13//!
14//! [dependencies]
15//! rand = { package = "shuttle-rand", version = "0.8.6" }
16//! ```
17//!
18//! The rest of the codebase then remains unchanged, and running with Shuttle-compatible `rand` can be done via the "shuttle" feature flag.
19
20cfg_if::cfg_if! {
21    if #[cfg(feature = "shuttle")] {
22        pub use shuttle_rand_inner::*;
23    } else {
24        pub use rand_orig::*;
25    }
26}