fix compile error

Signed-off-by: Renkai <gaelookair@gmail.com>
This commit is contained in:
Renkai 2020-04-07 16:58:23 +08:00
parent 4a859b8f6e
commit 25007df435
3 changed files with 8 additions and 6 deletions

View File

@ -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");

View File

@ -185,10 +185,11 @@ mod test {
reconnect_count: Mutex<usize>,
}
#[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<usize>,
}
#[async_trait]
impl Reconnect for MockClient {
type Cl = ();
fn reconnect(&self, _: u64) -> Result<()> {
async fn reconnect(&self, _: u64) -> Result<()> {
Ok(())
}

View File

@ -12,7 +12,7 @@ proptest! {
fn point(
pair in any::<KvPair>(),
) {
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::<KvPair>(), 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::<Vec<_>>();
block_on(