I am trying to use rusoto (https://rusoto.org) to access AWS S3 bucket, and started with this example https://rusoto.github.io/rusoto/rusoto_core/struct.EnvironmentProvider.html, but I get compilation errors.
The things that puzzles me is that the compiler says two opposing things at the same time :
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
4 | use futures::future::Future;
|
and
warning: unused import: `futures::future::Future`
--> src/main.rs:4:5
|
4 | use futures::future::Future;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
Steps to reproduce:
- code for Cargo.toml
[package]
name = "rusoto_s3_test"
version = "0.1.0"
[dependencies]
rusoto_core = "0.32.0"
rusoto_credential = "0.11.0"
futures = "0.2.1"
- code for src/main.rs:
extern crate futures;
extern crate rusoto_credential;
use futures::future::Future;
use rusoto_credential::{EnvironmentProvider, ProvideAwsCredentials};
use std::env;
fn main() {
env::set_var("AWS_ACCESS_KEY_ID", "ANTN35UAENTS5UIAEATD");
env::set_var("AWS_SECRET_ACCESS_KEY", "TtnuieannGt2rGuie2t8Tt7urarg5nauedRndrur");
env::set_var("AWS_SESSION_TOKEN", "DfnGs8Td4rT8r4srxAg6Td4rT8r4srxAg6GtkTir");
let creds = EnvironmentProvider.credentials().wait().unwrap();
assert_eq!(creds.aws_access_key_id(), "ANTN35UAENTS5UIAEATD");
assert_eq!(creds.aws_secret_access_key(), "TtnuieannGt2rGuie2t8Tt7urarg5nauedRndrur");
assert_eq!(creds.token(), &Some("DfnGs8Td4rT8r4srxAg6Td4rT8r4srxAg6GtkTir".to_string()));
assert!(creds.expires_at().is_none()); // doesn't expire
env::set_var("AWS_CREDENTIAL_EXPIRATION", "2018-04-21T01:13:02Z");
let creds = EnvironmentProvider.credentials().wait().unwrap();
assert_eq!(creds.expires_at().unwrap().to_rfc3339(), "2018-04-21T01:13:02+00:00");
}
- run
cargo build
I get the following build error:
Compiling rusoto_s3_test v0.1.0 (file:///Users/oferaffias/Development/projects/Rust/rusoto_s3_test)
warning: unused import: `futures::future::Future`
--> src/main.rs:4:5
|
4 | use futures::future::Future;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
error[E0599]: no method named `wait` found for type `rusoto_credential::environment::EnvironmentProviderFuture` in the current scope
--> src/main.rs:13:51
|
13 | let creds = EnvironmentProvider.credentials().wait().unwrap();
| ^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
4 | use futures::future::Future;
|
error[E0599]: no method named `wait` found for type `rusoto_credential::environment::EnvironmentProviderFuture` in the current scope
--> src/main.rs:21:51
|
21 | let creds = EnvironmentProvider.credentials().wait().unwrap();
| ^^^^
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
4 | use futures::future::Future;
|
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `rusoto_s3_test`.
Any ideas?