File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed
Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ license = "MIT"
77name = " envtestkit"
88version = " 1.0.0"
99
10- # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10+ [features ]
11+ default = [" lock" ]
12+ lock = [" lazy_static" , " parking_lot" ]
13+
14+ [dependencies ]
15+ lazy_static = { version = " 1.4.0" , optional = true }
16+ parking_lot = { version = " 0.11.0" , optional = true }
1117
1218[dev-dependencies ]
1319fake = " 2.2.3"
Original file line number Diff line number Diff line change 1- mod testkit;
1+ #[ cfg( feature = "lock" ) ]
2+ #[ macro_use]
3+ extern crate lazy_static;
4+
5+ #[ cfg( feature = "lock" ) ]
6+ pub mod lock;
27
3- pub use testkit:: set_env ;
4- pub use testkit:: EnvironmentTestGuard ;
8+ mod testkit;
9+ pub use testkit:: * ;
Original file line number Diff line number Diff line change 1+ use parking_lot:: lock_api:: { RwLockReadGuard , RwLockWriteGuard } ;
2+ use parking_lot:: RawRwLock ;
3+ use parking_lot:: RwLock ;
4+
5+ lazy_static ! {
6+ static ref LOCK : RwLock <( ) > = RwLock :: new( ( ) ) ;
7+ }
8+
9+ pub fn lock_read < ' a > ( ) -> RwLockReadGuard < ' a , RawRwLock , ( ) > {
10+ LOCK . read ( )
11+ }
12+
13+ pub fn lock_test < ' a > ( ) -> RwLockWriteGuard < ' a , RawRwLock , ( ) > {
14+ LOCK . write ( )
15+ }
You can’t perform that action at this time.
0 commit comments