Skip to content

Commit

Permalink
Request: impl AsRef<http::Request> and Into<http::Request>
Browse files Browse the repository at this point in the history
Refs: #465
  • Loading branch information
Fishrock123 committed May 17, 2020
1 parent 4a0487d commit 8669d5c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ impl<State> Request<State> {
}
}

impl<State> AsRef<http::Request> for Request<State> {
fn as_ref(&self) -> &http::Request {
&self.request
}
}

impl<State> Read for Request<State> {
fn poll_read(
mut self: Pin<&mut Self>,
Expand All @@ -318,6 +324,12 @@ impl<State> Read for Request<State> {
}
}

impl<State> Into<http::Request> for Request<State> {
fn into(self) -> http::Request {
self.request
}
}

// NOTE: From cannot be implemented for this conversion because `State` needs to
// be constrained by a type.
impl<State: Send + Sync + 'static> Into<Response> for Request<State> {
Expand Down

0 comments on commit 8669d5c

Please sign in to comment.