feat(server): add a deconstruct method to Request.
This commit is contained in:
		| @@ -32,7 +32,6 @@ pub struct Request<'a> { | |||||||
|  |  | ||||||
|  |  | ||||||
| impl<'a> Request<'a> { | impl<'a> Request<'a> { | ||||||
|  |  | ||||||
|     /// Create a new Request, reading the StartLine and Headers so they are |     /// Create a new Request, reading the StartLine and Headers so they are | ||||||
|     /// immediately useful. |     /// immediately useful. | ||||||
|     pub fn new(mut stream: &'a mut (Reader + 'a), addr: SocketAddr) -> HttpResult<Request<'a>> { |     pub fn new(mut stream: &'a mut (Reader + 'a), addr: SocketAddr) -> HttpResult<Request<'a>> { | ||||||
| @@ -64,6 +63,14 @@ impl<'a> Request<'a> { | |||||||
|             body: body |             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> { | impl<'a> Reader for Request<'a> { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user