Skip to content

hyper: re-use internal client, impl Default#45

Merged
Fishrock123 merged 4 commits intohttp-rs:mainfrom
Fishrock123:hyper-improvements
Oct 9, 2020
Merged

hyper: re-use internal client, impl Default#45
Fishrock123 merged 4 commits intohttp-rs:mainfrom
Fishrock123:hyper-improvements

Conversation

@Fishrock123
Copy link
Member

@Fishrock123 Fishrock123 commented Sep 22, 2020

  • Makes HyperClient impl Clone and Default
  • Re-uses the internal hyper client for pooling and alloc efficiency
  • Adds HyperClient::from_client()
  • Always uses the HttpsConnector (has internal http fallback)

Required for hyper-client in Surf:
http-rs/surf#234

@Fishrock123 Fishrock123 force-pushed the hyper-improvements branch 3 times, most recently from 349d385 to 9ccba5c Compare September 22, 2020 18:48
@Fishrock123 Fishrock123 reopened this Sep 23, 2020
@Fishrock123
Copy link
Member Author

Fishrock123 commented Sep 23, 2020

Edit: actually nightly broke: rust-lang/rust#77089

That docs failure is not our own but rather async-std's
error[E0046]: not all trait items implemented, missing: `as_flags`
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.6.4/src/fs/open_options.rs:303:5
    |
303 |     impl OpenOptionsExt for OpenOptions {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `as_flags` in implementation
    |
    = help: implement the missing item: `fn as_flags(&self) -> std::result::Result<i32, futures_io::Error> { todo!() }`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0046`.
error: could not compile `async-std`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0046]: not all trait items implemented, missing: `as_flags`
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.6.4/src/fs/open_options.rs:303:5
    |
303 |     impl OpenOptionsExt for OpenOptions {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `as_flags` in implementation
    |
    = help: implement the missing item: `fn as_flags(&self) -> std::result::Result<i32, futures_io::Error> { todo!() }`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0046`.
error: build failed
Error: Process completed with exit code 101.

@Fishrock123 Fishrock123 reopened this Sep 23, 2020
@Fishrock123 Fishrock123 reopened this Sep 24, 2020
@Fishrock123 Fishrock123 reopened this Sep 24, 2020
@Fishrock123 Fishrock123 changed the title hyper: Clone & Default, re-use internal client hyper: re-use internal client, impl Default Sep 24, 2020
- Makes HyperClient impl Clone and Default
- Re-uses the internal hyper client for pooling and alloc efficiency
- Adds HyperClient::from_client()
- Always uses the HttpsConnector (has internal http fallback)

Required for hyper-client in Surf:
http-rs/surf#234
Avoid leaking Hyper generics into HttpClient by hiding it behind a dynamic trait object pointer.
@Fishrock123
Copy link
Member Author

ok well, since this is feature flagged anyways I'm just gona merge it, since I want it for lambda.

@Fishrock123 Fishrock123 merged commit b9cc423 into http-rs:main Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant