File tree Expand file tree Collapse file tree 5 files changed +73
-1
lines changed
Expand file tree Collapse file tree 5 files changed +73
-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 = " 1.5.0"
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"
14+ shuttle-lazy_static-impl = { path = " ./lazy_static_impl" , version = " 0.1.0" , optional = true }
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " shuttle-lazy_static-impl"
3+ version = " 0.1.0"
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 crate contains Shuttle's internal implementations of the `lazy_static` crate.
2+ //! Do not depend on this crate directly. Use the `shuttle-lazy_static` crate, which conditionally
3+ //! exposes these implementations with the `shuttle` feature or the original crate without it.
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 = "1.5" }
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+ //! By default the version of `lazy_static` exported is the latest `1.x` version (the same as if you had written `lazy_static = "1"` in your Cargo.toml).
21+ //! If you need to constrain the version of `lazy_static` that you depend on (eg. to pin the version), then this can be done by adding an entry like:
22+ //!
23+ //! ```ignore
24+ //! [dependencies]
25+ //! lazy_static-version-import-dont-use = { package = "lazy_static", version = "=1.5.0" }
26+ //! ```
27+
28+ cfg_if:: cfg_if! {
29+ if #[ cfg( feature = "shuttle" ) ] {
30+ pub use shuttle_lazy_static_impl:: * ;
31+ } else {
32+ pub use lazy_static:: * ;
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments