xemwebe / yahoo_finance_api

Simple wrapper to yahoo! finance API to retrieve latest quotes and end-of-day quote histories
Apache License 2.0
64 stars 29 forks source link

Blocking feature stopped working #5

Closed celaus closed 3 years ago

celaus commented 3 years ago

Hi! Looks like there is an issue with the blocking feature in 0.3.4 and above.

...
   Compiling yahoo_finance_api v0.3.4
error[E0599]: no method named `compat` found for enum `std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>` in the current scope
   --> /Users/cm/.cargo/registry/src/github.com-1ecc6299db9ec823/yahoo_finance_api-0.3.4/src/lib.rs:460:44
    |
460 |     let resp = reqwest::blocking::get(url).compat();
    |                                            ^^^^^^ method not found in `std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>`
    |
   ::: /Users/cm/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/result.rs:247:1
    |
247 | pub enum Result<T, E> {
    | ---------------------
    | |
    | doesn't satisfy `_: std::future::Future`
    | doesn't satisfy `_: tokio_compat_02::FutureExt`
    |
    = note: the method `compat` exists but the following trait bounds were not satisfied:
            `std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: std::future::Future`
            which is required by `std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: tokio_compat_02::FutureExt`
            `&std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: std::future::Future`
            which is required by `&std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: tokio_compat_02::FutureExt`
            `&mut std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: std::future::Future`
            which is required by `&mut std::result::Result<reqwest::blocking::response::Response, reqwest::error::Error>: tokio_compat_02::FutureExt`

error: aborting due to previous error

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

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
celaus commented 3 years ago

cargo.toml:

...
yahoo_finance_api = {version = "0.3.4", features = ["blocking"]}
xemwebe commented 3 years ago

Haven't observed that error yet, I will have a look at it.

xemwebe commented 3 years ago

Okay, I fixed it already. The call to compat() was just superfluous at this location and has been removed. Version 1.0.1 should not have this bug.