feat(server): add a deconstruct method to Request.

This commit is contained in:
Jonathan Reem
2015-01-21 01:15:21 +01:00
parent 2790f604b0
commit 1014855fae

View File

@@ -32,7 +32,6 @@ pub struct Request<'a> {
impl<'a> Request<'a> {
/// Create a new Request, reading the StartLine and Headers so they are
/// immediately useful.
pub fn new(mut stream: &'a mut (Reader + 'a), addr: SocketAddr) -> HttpResult<Request<'a>> {
@@ -64,6 +63,14 @@ impl<'a> Request<'a> {
body: body
})
}
/// Deconstruct a Request into its constituent parts.
pub fn deconstruct(self) -> (SocketAddr, Method, Headers,
RequestUri, HttpVersion,
HttpReader<&'a mut (Reader + 'a)>,) {
(self.remote_addr, self.method, self.headers,
self.uri, self.version, self.body)
}
}
impl<'a> Reader for Request<'a> {