Redis 在Rust中将同步闭包移植到异步闭包时的生存期问题

Redis 在Rust中将同步闭包移植到异步闭包时的生存期问题,redis,rust,async-await,rust-tokio,Redis,Rust,Async Await,Rust Tokio,我目前正在尝试将一些使用crate和Redis事务的锈迹代码从同步代码移植到异步代码,并且遇到了一些问题(目前与生存期相关,但根本原因可能在端口的其他地方) 这两种情况下的代码都在Cargo.toml中使用以下依赖项: [dependencies] redis = "0.16" tokio = { version = "0.2", features = ["full"] } 工作同步代码的最小示例如下所示: 使用redis::{pip

我目前正在尝试将一些使用crate和Redis事务的锈迹代码从同步代码移植到异步代码,并且遇到了一些问题(目前与生存期相关,但根本原因可能在端口的其他地方)

这两种情况下的代码都在
Cargo.toml
中使用以下依赖项:

[dependencies]
redis = "0.16"
tokio = { version = "0.2", features = ["full"] }
工作同步代码的最小示例如下所示:

使用redis::{pipe,cmd,Pipeline,ToRedisArgs,RedisResult};
fn main()->RedisResult{
让client=redis::client::open(“redis://127.0.0.1/)展开();
让mut sync_conn=client.get_connection()?;
让key=“foo”;
let(val,):(u32,)=事务(&mut-sync_-conn,&key],|conn,pipe |{
管道组件(图例1)
.ignore()
.get(键)
.查询(康涅狄格州)
})?;
println!(“val:{}”,val);
好(())
}
fn交易<
C:redis::连接类,
K:ToRedisArgs,
T
F:FnMut(&mut C,&mut管道)->RedisResult,
>(
con:&mut C,
键:&[K],
func:F,
)->重新分配结果{
设mut func=func;
环路{
cmd(“WATCH”).arg(键).query(con)?;
如果让一些(响应)=func(con,pipe().atomic()){
cmd(“UNWATCH”).query(con)?;
返回Ok(响应);
}
}
}
我尝试将此代码转换为异步代码,如下所示:

使用redis::{AsyncCommands,pipe,cmd,Pipeline,ToRedisArgs,RedisResult,aio::ConnectionLike};
使用std::future::future;
#[tokio::main]
异步fn main()->RedisResult{
让client=redis::client::open(“redis://127.0.0.1/)展开();
让mut async_conn=client.get_async_connection().wait?;
让key=“foo”;
let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe|async{
管道组件(图例1)
.ignore()
.get(键)
.query\u async(conn).等待
}).等待?;
println!(“val:{}”,val);
好(())
}
发布异步fn异步\u事务<
C:连接式+发送,
K:ToRedisArgs,
T
F:FnMut(&mut C,&mut管道)->Fut,
未来,,
>(
con:&mut C,
键:&[K],
func:F,
)->重新分配结果{
设mut func=func;
环路{
cmd(“WATCH”).arg(键)。query_async(con)。wait?;
如果让一些(响应)=func(con,pipe().atomic())。等待{
cmd(“UNWATCH”).query_async(con.wait?;
返回Ok(响应);
}
}
}
主要的变化是使用异步连接,使用async/wait和
query\u async
而不是
query
。另一个主要变化是传递给
async_transaction
的函数返回一个
Future
,而不是直接返回结果

然而,试图编译此文件会导致19个错误(它们大多是基于生命周期的):

error[E0486]:表达式类型包含在表达式中无效的引用:`for fn(&mut redis::aio::Connection,&[&str][closure@src/main.rs:11:69:16:6键:&&str])->impl std::future::future{async_事务::}`
-->src/main.rs:11:26
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|                          ^^^^^^^^^^^^^^^^^
|
注意:类型仅对11:69在主体上定义的匿名生存期#2有效
-->src/main.rs:11:69
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|  _____________________________________________________________________^
12 | |管道组(图例1)
13 | |忽略()
14 | |获取(关键)
15 | |.查询异步(conn).等待
等待?;
| |_____^
错误[E0486]:表达式类型包含在表达式中无效的引用:`for fn(&mut redis::aio::Connection,&[&str][closure@src/main.rs:11:69:16:6键:&&str])->impl std::future::future{async_事务::}`
-->src/main.rs:11:26
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|                          ^^^^^^^^^^^^^^^^^
|
注意:类型仅对11:69在主体上定义的匿名生存期#3有效
-->src/main.rs:11:69
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|  _____________________________________________________________________^
12 | |管道组(图例1)
13 | |忽略()
14 | |获取(关键)
15 | |.查询异步(conn).等待
等待?;
| |_____^
错误[E0486]:表达式类型包含在表达式中无效的引用:`impl std::future::future`
-->src/main.rs:11:26
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|  __________________________^
12 | |管道组(图例1)
13 | |忽略()
14 | |获取(关键)
15 | |.查询异步(conn).等待
等待?;
| |______^
|
注意:类型仅对11:69在主体上定义的匿名生存期#2有效
-->src/main.rs:11:69
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|  _____________________________________________________________________^
12 | |管道组(图例1)
13 | |忽略()
14 | |获取(关键)
15 | |.查询异步(conn).等待
等待?;
| |_____^
错误[E0486]:表达式类型包含在表达式中无效的引用:`impl std::future::future`
-->src/main.rs:11:26
|
11 | let(val,):(u32,)=async_事务(&mut async_conn,&key],| conn,pipe | async{
|  __________________________^
12 | |管道组(图例1)
13 | |忽略()
14 | |获取(关键)
15 | |.查询异步(conn).等待
等待?;
| |______^
|
注:类型仅为v
error[E0486]: type of expression contains references that are not valid during the expression: `for<'_, '_> fn(&mut redis::aio::Connection, &[&str], [closure@src/main.rs:11:69: 16:6 key:&&str]) -> impl std::future::Future {async_transaction::<redis::aio::Connection, &str, (u32,), [closure@src/main.rs:11:69: 16:6 key:&&str], impl std::future::Future>}`
  --> src/main.rs:11:26
   |
11 |     let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |                          ^^^^^^^^^^^^^^^^^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `for<'_, '_> fn(&mut redis::aio::Connection, &[&str], [closure@src/main.rs:11:69: 16:6 key:&&str]) -> impl std::future::Future {async_transaction::<redis::aio::Connection, &str, (u32,), [closure@src/main.rs:11:69: 16:6 key:&&str], impl std::future::Future>}`
  --> src/main.rs:11:26
   |
11 |     let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |                          ^^^^^^^^^^^^^^^^^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |______^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |______^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `&mut impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `&mut impl std::future::Future`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `unsafe fn(&mut impl std::future::Future) -> std::pin::Pin<&mut impl std::future::Future> {std::pin::Pin::<&mut impl std::future::Future>::new_unchecked}`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `unsafe fn(&mut impl std::future::Future) -> std::pin::Pin<&mut impl std::future::Future> {std::pin::Pin::<&mut impl std::future::Future>::new_unchecked}`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `std::pin::Pin<&mut impl std::future::Future>`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `std::pin::Pin<&mut impl std::future::Future>`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `for<'r, 's, 't0> fn(std::pin::Pin<&'r mut impl std::future::Future>, &'s mut std::task::Context<'t0>) -> std::task::Poll<<impl std::future::Future as std::future::Future>::Output> {<impl std::future::Future as std::future::Future>::poll}`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0486]: type of expression contains references that are not valid during the expression: `for<'r, 's, 't0> fn(std::pin::Pin<&'r mut impl std::future::Future>, &'s mut std::task::Context<'t0>) -> std::task::Poll<<impl std::future::Future as std::future::Future>::Output> {<impl std::future::Future as std::future::Future>::poll}`
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: type is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0481]: lifetime of function argument does not outlive the function call
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: the function argument is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0481]: lifetime of function argument does not outlive the function call
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: the function argument is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0488]: lifetime of variable does not enclose its declaration
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: the variable is only valid for the anonymous lifetime #2 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0488]: lifetime of variable does not enclose its declaration
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: the variable is only valid for the anonymous lifetime #3 defined on the body at 11:69
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^

error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
   |
note: first, the lifetime cannot outlive the anonymous lifetime #3 defined on the body at 11:69...
  --> src/main.rs:11:69
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  _____________________________________________________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |_____^
note: ...so that the type `impl std::future::Future` is not borrowed for too long
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
note: but, the lifetime must be valid for the call at 11:26...
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^
note: ...so that argument is valid for the call
  --> src/main.rs:11:26
   |
11 |       let (val,): (u32,) = async_transaction(&mut async_conn, &[key], |conn, pipe| async {
   |  __________________________^
12 | |         pipe.set(key, 1)
13 | |             .ignore()
14 | |             .get(key)
15 | |             .query_async(conn).await
16 | |     }).await?;
   | |____________^

error: aborting due to 19 previous errors

For more information about this error, try `rustc --explain E0495`.
error: could not compile `redistest`.

To learn more, run the command again with --verbose.