-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return
impl Future
instead of Pin<Box<dyn Future>>
Returning a boxed trait object requires specifying whether the returned future is `Send`/`Sync`, which means we can't support both `Send` and non-`Send` async HTTP clients. The `reqwest` client returns a `Send` future when using versions of `hyper` >= 0.14.14 (see hyperium/hyper#2653), except in WASM builds, for which the future is non-`Send`. With this change, each `request_async()` method now returns `impl Future`, which may or may not be `Send` depending on the inputs. This provides the flexibility to support all the necessary HTTP clients, while providing the convenience of `Send` futures for the built-in `reqwest` client in non-WASM builds. BREAKING CHANGES: - Removed `TokenRequestFuture` and `DeviceAuthorizationRequestFuture` type aliases. - Added `Future` associated type to `AsyncHttpClient` trait and changed `call()` method to return `Self::Future` (which may or may not be `Send`/`Sync`). - Changed each `request_async()` method to return `impl Future` instead of `Pin<Box<dyn Future>>`. Fixes #255 and #260.
- Loading branch information
Showing
8 changed files
with
864 additions
and
540 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters