I'm attempting to list the objects of an S3 bucket using rusoto_s3
and have run against an error I think I understand, but would like validation on.
Below are the vitals:
- Rust version: rustc 1.58.1 (db9d1b20b 2022-01-20)
- rusoto_s3 = "0.42.0"
- tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
Minimal Example:
#[tokio::main]
async fn main() {
let args = Opts::from_args();
let client = S3Client::new(Region::UsEast1);
let resp = client.list_objects_v2(ListObjectsV2Request {
bucket: args.location.bucket,
prefix: args.location.path,
..Default::default()
}).await;
}
Attempting to compile the above snippet results in the following error:
error[E0277]: `rusoto_core::future::RusotoFuture<ListObjectsV2Output, ListObjectsV2Error>` is not a future
--> src/bin/list_objects/main.rs:47:16
|
47 | let resp = client.list_objects_v2(ListObjectsV2Request {
| ________________^
48 | | bucket: args.location.bucket,
49 | | prefix: args.location.path,
50 | | ..Default::default()
51 | | }).await;
| |____________^ `rusoto_core::future::RusotoFuture<ListObjectsV2Output, ListObjectsV2Error>` is not a future
|
= help: the trait `Future` is not implemented for `rusoto_core::future::RusotoFuture<ListObjectsV2Output, ListObjectsV2Error>`
My assumption is that there's a mismatch between Future
here. RusotoFuture
implements futures::Future
but I'm guessing the Future
referenced in the error message is actually std::futures::Future
. Does this seem plausible?
I feel like this worked as is at some point in the past ( I don't have evidence to back that up, so it's entirely possible I'm misremembering). I noticed rusoto
is in maintenance mode; is it possible this is drift between rust version and a potentially aging crate? Am I just doing it wrong?
Whatever the case, this issue has afforded an interesting challenge: How could I implement std::future::Future
for RusotoFuture
given that the struct is not in my crate, and the trait is in the std library? Define some form of adapter struct/enum in my own create and implement std::future::Future
for that construct? I'd love to hear some thoughts.