rust - 为什么shiplift 0.6 中的类型说`std::future::Future` 不满足?
问题描述
我正在使用该shiplift
库对 Rust 进行试验,并尝试运行 repo 中提供的基本示例。
use shiplift::Docker;
#[tokio::main]
async fn main() {
let docker = Docker::new();
match docker.info().await {
Ok(info) => println!("info {:?}", info),
Err(e) => eprintln!("Error: {}", e),
}
}
当我尝试编译时,出现错误:
Compiling foo v0.1.0 (/Users/cbourne/development/rust/foo)
error[E0277]: the trait bound `impl futures::future::Future: std::future::Future` is not satisfied
--> src/main.rs:7:11
|
7 | match docker.info().await {
| ^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `impl futures::future::Future`
|
= note: required by `std::future::Future::poll`
我的Cargo.toml
文件如下所示:
[package]
name = "foo"
version = "0.1.0"
authors = ["carlskii"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
shiplift = "0.6"
tokio = { version = "0.2.22", features = ["macros", "tcp", "dns", "io-util"] }
log = "0.4.0"
env_logger = "0.7.1"
futures = "0.3.1"
解决方案
推荐阅读
- sql - 如何捕获基于 Web 的应用程序发送到 Oracle 服务器的 SQL 查询?
- mysql - SQL 中的正则表达式性能
- python - 返回 UnboundLocalError 的 Zip() 函数:分配前引用的局部变量 'zip'
- pytest - 如何从 unittest TestCase 类中声明的测试方法中获取夹具值?
- python - 使用查询字符串过滤 MultiIndex
- javascript - 如何在Javascript中跟踪局部变量值?
- django - 使用 DRF 在 Django 中与生成的令牌和魔术 URL 共享
- android - 片段 newInstance
- android - 在 Play Store 和 App Store 上为不同的客户发布相同的应用程序
- javascript - 如何构建响应式 Vuetify 应用栏