From 25007df435cc8227a27a00ee164ebe22859aae90 Mon Sep 17 00:00:00 2001 From: Renkai Date: Tue, 7 Apr 2020 16:58:23 +0800 Subject: [PATCH] fix compile error Signed-off-by: Renkai --- examples/raw.rs | 4 ++-- src/pd/retry.rs | 6 ++++-- src/proptests/raw.rs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/raw.rs b/examples/raw.rs index 2c68f56..cf16476 100644 --- a/examples/raw.rs +++ b/examples/raw.rs @@ -26,7 +26,7 @@ async fn main() -> Result<()> { // When we first create a client we receive a `Connect` structure which must be resolved before // the client is actually connected and usable. - let client = Client::new(config)?; + let client = Client::new(config).await?; // Requests are created from the connected client. These calls return structures which // implement `Future`. This means the `Future` must be resolved before the action ever takes @@ -87,7 +87,7 @@ async fn main() -> Result<()> { let end = "k2"; let pairs = client .with_key_only(true) - .scan((start..=end).to_owned(), 10) + .scan((start..=end).to_owned(), 10 as u32) .await .expect("Could not scan"); diff --git a/src/pd/retry.rs b/src/pd/retry.rs index 2e84ac8..5d5b5df 100644 --- a/src/pd/retry.rs +++ b/src/pd/retry.rs @@ -185,10 +185,11 @@ mod test { reconnect_count: Mutex, } + #[async_trait] impl Reconnect for MockClient { type Cl = (); - fn reconnect(&self, _: u64) -> Result<()> { + async fn reconnect(&self, _: u64) -> Result<()> { *self.reconnect_count.lock().unwrap() += 1; // Not actually unimplemented, we just don't care about the error. Err(Error::unimplemented()) @@ -223,10 +224,11 @@ mod test { retry_count: Mutex, } + #[async_trait] impl Reconnect for MockClient { type Cl = (); - fn reconnect(&self, _: u64) -> Result<()> { + async fn reconnect(&self, _: u64) -> Result<()> { Ok(()) } diff --git a/src/proptests/raw.rs b/src/proptests/raw.rs index de7ce49..f1560ff 100644 --- a/src/proptests/raw.rs +++ b/src/proptests/raw.rs @@ -12,7 +12,7 @@ proptest! { fn point( pair in any::(), ) { - let client = Client::new(Config::new(pd_addrs())).unwrap(); + let client = block_on(Client::new(Config::new(pd_addrs()))).unwrap(); block_on( client.put(pair.key().clone(), pair.value().clone()) @@ -36,7 +36,7 @@ proptest! { fn batch( kvs in arb_batch(any::(), None), ) { - let client = Client::new(Config::new(pd_addrs())).unwrap(); + let client = block_on(Client::new(Config::new(pd_addrs()))).unwrap(); let keys = kvs.iter().map(|kv| kv.key()).cloned().collect::>(); block_on(