'parkinglot' has a lot variants for locking, there is the normal blocking lock, a trylock, two forms of timed try locks and all of these are available as recursive variant as well.
This leads to a some explosion on the api, dispatching to these variants in generic code becomes pretty bloated. This crate abstracts all the different locking variants into a single trait with a uniform API that takes policy objects for the dispatch on underlying locking methods
``` // reexports parts of parkinglot as well use parkingmethod::*;
let rwlock = RwLock::new(String::from("test"));
// Note the 2 following syntax forms are equivalent asserteq!(*Blocking.read(&rwlock).unwrap(), "test"); asserteq!(*RwLockMethod::read(&Blocking, &rwlock).unwrap(), "test");
assert_eq!(*TryLock.read(&rwlock).unwrap(), "test");
let timeout = Duration::from_millis(100);
assert_eq!( *RwLockMethod::read(&timeout, &rwlock).unwrap(), "test" );
asserteq!( *RwLockMethod::read( &Recursive(Instant::now() + Duration::frommillis(100)), &rwlock).unwrap(), "test" ); ```