ramosbugs / oauth2-rs

Extensible, strongly-typed Rust OAuth2 client library
Apache License 2.0
939 stars 163 forks source link

Make `AsyncHttpClient::Future` `Send` on non-wasm archs #280

Closed bnjbvr closed 4 months ago

bnjbvr commented 4 months ago

This is useful for adding some Send bounds on other methods in the dependent openidconnect-rs crate (here). Since there was a cfg guard for wasm in the reqwest_client implementation, I also included it here, so that wasm doesn't require the bound itself.

ramosbugs commented 4 months ago

Hey @bnjbvr, I'm confused why the Send bound is needed either on the trait's associated type or on the methods in openidconnect.

Note that even if the bounds are needed in openidconnect, Rust 1.79 stabilized bounds on associated types, which should avoid the need to add the bound here (at the cost of incrementing the MSRV in the other crate).

I believe 6e583bd03203e42ef712fc90edb57cf5a389f9b7 should have fixed the issues around Send bounds. When using a Send HTTP client, the compiler should automatically infer Send for the returned future. See related discussions in #260, #255, and ramosbugs/openidconnect-rs#171.

ramosbugs commented 4 months ago

If possible, I'd like to continue supporting both Send and non-Send HTTP clients.

bnjbvr commented 4 months ago

Ah indeed, thanks for the push back, I hadn't retried with the latest commit of the crate, and turns out the Send bound isn't required anymore. Closing this.