Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): redesign the Connect trait #1428

Closed
wants to merge 1 commit into from
Closed

Commits on Jan 30, 2018

  1. feat(client): redesign the Connect trait

    The original `Connect` trait had some limitations:
    
    - There was no way to provide more details to the connector about how to
      connect, other than the `Uri`.
    - There was no way for the connector to return any extra information
      about the connected transport.
    - The `Error` was forced to be an `std::io::Error`.
    - The transport and future had `'static` requirements.
    
    As hyper gains HTTP/2 support, some of these things needed to be
    changed. We want to allow the user to configure whether they hope to
    us ALPN to start an HTTP/2 connection, and the connector needs to be
    able to return back to hyper if it did so.
    
    The new `Connect2` trait is meant to solve this.
    
    - The `connect` method now receives a `Destination` type, instead of a
      `Uri`. This allows us to include additional data about how to connect.
    - The `Future` returned from `connect` now must be a tuple of the
      transport, and a `Connected` metadata value. The `Connected` includes
      possibly extra data about what happened when connecting.
    
    The `Connect` trait is deprecated, with the hopes of `Connect2` taking
    it's place in the next breaking release. For backwards compatibility,
    any type that implements `Connect` now will automatically implement
    `Connect2`, ignoring any of the extra data from `Destination` and
    `Connected`.
    seanmonstar committed Jan 30, 2018
    Configuration menu
    Copy the full SHA
    fe60c7b View commit details
    Browse the repository at this point in the history