Skip to content

Commit

Permalink
feat(server): add a deconstruct method to Request.
Browse files Browse the repository at this point in the history
  • Loading branch information
reem committed Jan 21, 2015
1 parent 2790f60 commit 1014855
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>> {
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit 1014855

Please sign in to comment.