File tree Expand file tree Collapse file tree 5 files changed +65
-1
lines changed
Expand file tree Collapse file tree 5 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ members = [
33 " shuttle" ,
44 " wrappers/shuttle_rand_0.8" ,
55 " wrappers/shuttle_sync" ,
6+ " wrappers/lazy_static" ,
67]
78
8- resolver = " 2"
9+ resolver = " 2"
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " shuttle-lazy_static"
3+ version = " 0.0.1"
4+ edition = " 2024"
5+
6+ [features ]
7+ shuttle = [" dep:shuttle-lazy_static-impl" ]
8+
9+ spin_no_std = [ " lazy_static/spin_no_std" , " shuttle-lazy_static-impl?/spin_no_std" ]
10+
11+ [dependencies ]
12+ cfg-if = " 1.0"
13+ lazy_static = " 1.4"
14+ shuttle-lazy_static-impl = { path = " ./lazy_static_impl" , version = " 0.0.1" , optional = true }
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " shuttle-lazy_static-impl"
3+ version = " 0.0.1"
4+ edition = " 2024"
5+
6+ [features ]
7+ spin_no_std = []
8+
9+ [dependencies ]
10+ shuttle = { path = " ../../../shuttle" , version = " *" }
Original file line number Diff line number Diff line change 1+ //! This is the "impl" crate implementing [lazy_static] support for [`Shuttle`].
2+ //! This crate should not be depended on directly, the intended way to use this crate is via
3+ //! the `shuttle-lazy_static` crate and feature flag `shuttle`.
4+ //!
5+ //! [`Shuttle`]: <https://crates.io/crates/shuttle>
6+ //!
7+ //! [`lazy_static`]: <https://crates.io/crates/lazy_static>
8+
9+ // The reason this crate exists and we don't just import directly from shuttle in the wrapper is
10+ // that by doing it like this we can change where the implementation is sourced from without changing
11+ // the wrapper, which is a property needed if one wants the wrapper version to match the version of
12+ // `lazy_static`
13+ pub use shuttle:: lazy_static:: * ;
Original file line number Diff line number Diff line change 1+ //! This crate provides a Shuttle-compatible implementation and wrapper for [`lazy_static`] in order to make it
2+ //! more ergonomic to run a codebase under Shuttle.
3+ //!
4+ //! [`lazy_static`]: <https://crates.io/crates/lazy_static>
5+ //!
6+ //! To use this crate, add something akin to the following to your Cargo.toml:
7+ //!
8+ //! ```ignore
9+ //! [features]
10+ //! shuttle = [
11+ //! "lazy_static/shuttle",
12+ //! ]
13+ //!
14+ //! [dependencies]
15+ //! lazy_static = { package = "shuttle-lazy_static", version = "VERSION_NUMBER" }
16+ //! ```
17+ //!
18+ //! The rest of the codebase then remains unchanged, and running with Shuttle-compatible `lazy_static` can be done via the "shuttle" feature flag.
19+
20+ cfg_if:: cfg_if! {
21+ if #[ cfg( feature = "shuttle" ) ] {
22+ pub use shuttle_lazy_static_impl:: * ;
23+ } else {
24+ pub use lazy_static:: * ;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments