Use dynamic dispatch for client Request and Response through Box<NetworkStream>

Also adds a convenience `abstract` method to NetworkStream for creating
Box<NetworkStream + Send> from a NetworkStream.
This commit is contained in:
Jonathan Reem
2014-09-09 16:51:32 -07:00
parent 8026867334
commit ed491655dd
5 changed files with 31 additions and 15 deletions

View File

@@ -66,7 +66,7 @@ impl Response<Fresh> {
status: status::Ok,
version: version::Http11,
headers: header::Headers::new(),
body: BufferedWriter::new(box stream as Box<NetworkStream + Send>)
body: BufferedWriter::new(stream.abstract())
}
}