feat(client): impl Sync for Client

Connector::connect already used &self, and so would require
synchronization to be handled per connector anyway. Adding Sync to the
Client allows users to setup config for a Client once, such as using a
single connection Pool, and then making requests across multiple
threads.

Closes #254

BREAKING CHANGE: Connectors and Protocols passed to the `Client` must
  now also have a `Sync` bounds, but this shouldn't break default usage.
This commit is contained in:
Sean McArthur
2015-06-12 11:19:54 -07:00
parent d7fa961a79
commit 64e47b4bbd
7 changed files with 51 additions and 22 deletions

View File

@@ -198,3 +198,8 @@ fn _assert_send<T: Send>() {
_assert_send::<client::Request<net::Fresh>>();
_assert_send::<client::Response>();
}
#[allow(unconditional_recursion)]
fn _assert_sync<T: Sync>() {
_assert_sync::<Client>();
}