Skip to content

Commit 1014855

Browse files
committed
feat(server): add a deconstruct method to Request.
1 parent 2790f60 commit 1014855

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/server/request.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub struct Request<'a> {
3232

3333

3434
impl<'a> Request<'a> {
35-
3635
/// Create a new Request, reading the StartLine and Headers so they are
3736
/// immediately useful.
3837
pub fn new(mut stream: &'a mut (Reader + 'a), addr: SocketAddr) -> HttpResult<Request<'a>> {
@@ -64,6 +63,14 @@ impl<'a> Request<'a> {
6463
body: body
6564
})
6665
}
66+
67+
/// Deconstruct a Request into its constituent parts.
68+
pub fn deconstruct(self) -> (SocketAddr, Method, Headers,
69+
RequestUri, HttpVersion,
70+
HttpReader<&'a mut (Reader + 'a)>,) {
71+
(self.remote_addr, self.method, self.headers,
72+
self.uri, self.version, self.body)
73+
}
6774
}
6875

6976
impl<'a> Reader for Request<'a> {

0 commit comments

Comments
 (0)