feat(net): remove mut requirement for NetworkConnector.connect()
BREAKING CHANGE: Any custom Connectors will need to change to &self in the connect method. Any Connectors that needed the mutablity need to figure out a synchronization strategy. Request::with_connector() takes a &NetworkConnector instead of &mut. Any uses of with_connector will need to change to passing &C.
This commit is contained in:
@@ -79,7 +79,7 @@ struct MockConnector;
|
||||
|
||||
impl net::NetworkConnector for MockConnector {
|
||||
type Stream = MockStream;
|
||||
fn connect(&mut self, _: &str, _: u16, _: &str) -> hyper::Result<MockStream> {
|
||||
fn connect(&self, _: &str, _: u16, _: &str) -> hyper::Result<MockStream> {
|
||||
Ok(MockStream::new())
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ fn bench_mock_hyper(b: &mut test::Bencher) {
|
||||
let url = "http://127.0.0.1:1337/";
|
||||
b.iter(|| {
|
||||
let mut req = hyper::client::Request::with_connector(
|
||||
hyper::Get, hyper::Url::parse(url).unwrap(), &mut MockConnector
|
||||
hyper::Get, hyper::Url::parse(url).unwrap(), &MockConnector
|
||||
).unwrap();
|
||||
req.headers_mut().set(Foo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user