Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.02k stars 136 forks source link

Update hyper-rustls dependency #307

Closed DeboMac closed 2 years ago

DeboMac commented 2 years ago

Currently, it's impossible to specify such dependencies (even if, in my honest opinion, it's a bit cargo's fault):

[dependencies]
hyper = "*"
hyper-rustls = "*"
google-drive3 = "*"

because cargo will resolve hyper-rustls v0.23.0 for the whole project, and hyper-rustls v0.22.1 for google_drive3.

Then, it becomes impossible to write:

    let hub = google_drive3::DriveHub::new(
        hyper::Client::builder().build(
            hyper_rustls::HttpsConnectorBuilder::new()
                .with_native_roots()
                .https_only()
                .enable_http1()
                .build(),
        ),
        todo!()
    );

because it fails with:

error[E0308]: mismatched types
 --> src/main.rs:4:13
  |
4 | /             hyper_rustls::HttpsConnectorBuilder::new()
5 | |                 .with_native_roots()
6 | |                 .https_only()
7 | |                 .enable_http1()
8 | |                 .build(),
  | |________________________^ expected struct `hyper_rustls::connector::HttpsConnector`, found struct `HttpsConnector`
  |
  = note: expected struct `hyper_rustls::connector::HttpsConnector<HttpConnector>`
             found struct `HttpsConnector<HttpConnector>`
  = note: perhaps two different versions of crate `hyper_rustls` are being used?

Maybe this dependency should be updated, or, like it was done in this issue, the hyper and the hyper-rustls crate should be exposed ?

Thank you very much

Byron commented 2 years ago

Thanks for describing the problem so accurately, whilst providing a solution to avoid users of these crates having to follow the exact version of dependent crates in their cargo manifests while exposing themselves to surprises.

I think a fix could be applied similarly as done in the linked issue.