Skip to content

Commit

Permalink
Merge pull request #261 from reem/request-deconstruct
Browse files Browse the repository at this point in the history
server(feat): add a deconstruct method to Request.
  • Loading branch information
reem committed Jan 21, 2015
2 parents 401ae4e + 1014855 commit cd1a656
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 cd1a656

Please sign in to comment.