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:
Sean McArthur
2015-05-08 20:54:05 -07:00
parent 7bc4e83ec2
commit 1b318724a5
6 changed files with 16 additions and 16 deletions

View File

@@ -74,7 +74,7 @@ pub struct MockConnector;
impl NetworkConnector for MockConnector {
type Stream = MockStream;
fn connect(&mut self, _host: &str, _port: u16, _scheme: &str) -> ::Result<MockStream> {
fn connect(&self, _host: &str, _port: u16, _scheme: &str) -> ::Result<MockStream> {
Ok(MockStream::new())
}
@@ -122,7 +122,7 @@ macro_rules! mock_connector (
impl ::net::NetworkConnector for $name {
type Stream = ::mock::MockStream;
fn connect(&mut self, host: &str, port: u16, scheme: &str) -> $crate::Result<::mock::MockStream> {
fn connect(&self, host: &str, port: u16, scheme: &str) -> $crate::Result<::mock::MockStream> {
use std::collections::HashMap;
use std::io::Cursor;
debug!("MockStream::connect({:?}, {:?}, {:?})", host, port, scheme);