waitmap icon indicating copy to clipboard operation
waitmap copied to clipboard

Remove K: From<&'b Q> bound on wait() and wait_mut()

Open ebkalderon opened this issue 5 years ago • 0 comments

Due to the K: From<&'b Q> bound on WaitMap::wait() and WaitMap::wait_mut(), it is impossible to use certain types such as u64 as a key.

let map = WaitMap::new();
map.insert(1u64, "foo".to_string());
let result = map.wait(&1).await;

The above code outputs the following error:

error[E0277]: the trait bound `u64: std::convert::From<&u64>` is not satisfied
  --> src/main.rs:6:22
   |
19 |     let result = map.wait(&1).await;
   |                      ^^^^ the trait `std::convert::From<&u64>` is not implemented for `u64`
   |
   = help: the following implementations were found:
             <u64 as std::convert::From<bool>>
             <u64 as std::convert::From<std::num::NonZeroU64>>
             <u64 as std::convert::From<u16>>
             <u64 as std::convert::From<u32>>
             <u64 as std::convert::From<u8>>

ebkalderon avatar Apr 29 '20 07:04 ebkalderon