ferristseng / rust-ipfs-api

IPFS HTTP client in Rust
Apache License 2.0
246 stars 68 forks source link

Disambiguate IpfsClient::default() when using feature with-hyper-tls #117

Closed iamjpotts closed 1 year ago

iamjpotts commented 1 year ago

When the with-hyper-tls feature is enabled, this will fail to compile:

let client = IpfsClient::default()

It fails because there are two implementations of the Default trait - one which is typed IpfsClient<HttpConnector> and another typed IpfsClient<HttpsConnector<HttpConnector>> - which has the unfortunate consequence of requiring the call site to disambiguate it, even if the call site does not care which Hyper connector is in play.

I've added docstring examples which trigger this problem, and demonstrate that it's fixed in this PR.

iamjpotts commented 1 year ago

CI error with cargo fmt is resolved.

ferristseng commented 1 year ago

Looks awesome, thanks!