shuttle_sync/lib.rs
1//! This crate provides a Shuttle-compatible wrapper for [`std::sync`] in order to make it
2//! more ergonomic to run a codebase under Shuttle.
3//!
4//! To use this crate, add something akin to the following to your Cargo.toml:
5//!
6//! ```ignore
7//! [features]
8//! shuttle = [
9//! "shuttle-sync/shuttle",
10//! ]
11//!
12//! [dependencies]
13//! shuttle-sync = "VERSION_NUMBER"
14//! ```
15//!
16//! The rest of the codebase then remains unchanged, and running with Shuttle-compatible `sync` can be done via the "shuttle" feature flag.
17//!
18//! Note that this crate reexports the entirety of `std::sync`, which contains
19//! functionality not present in `shuttle::sync`. This means that the "naive"
20//! approach of swapping out all occurrences of `std::sync` is likely to result
21//! in not found errors once the "shuttle" feature flag is enabled. The missing
22//! functionality will either have to be always gotten from `std`, ie by importing
23//! them directly from `std::sync`, or support for the functionality will have
24//! to be added to Shuttle.
25
26pub mod sync {
27 cfg_if::cfg_if! {
28 if #[cfg(feature = "shuttle")] {
29 pub use shuttle_sync_inner::sync::*;
30 } else {
31 pub use std::sync::*;
32 }
33 }
34}