refactor(lib): rename http_types to http

This commit is contained in:
Sean McArthur
2017-09-29 18:12:55 -07:00
parent 6f71932015
commit 9c80fdbb9e
12 changed files with 97 additions and 97 deletions

View File

@@ -4,7 +4,7 @@ use std::mem::replace;
use std::net::SocketAddr;
#[cfg(feature = "compat")]
use http_types;
use http;
use header::Headers;
use proto::{Body, MessageHead, RequestHead, RequestLine};
@@ -138,11 +138,11 @@ impl<B> fmt::Debug for Request<B> {
}
#[cfg(feature = "compat")]
impl From<Request> for http_types::Request<Body> {
fn from(from_req: Request) -> http_types::Request<Body> {
impl From<Request> for http::Request<Body> {
fn from(from_req: Request) -> http::Request<Body> {
let (m, u, v, h, b) = from_req.deconstruct();
let to_req = http_types::Request::new(());
let to_req = http::Request::new(());
let (mut to_parts, _) = to_req.into_parts();
to_parts.method = m.into();
@@ -150,13 +150,13 @@ impl From<Request> for http_types::Request<Body> {
to_parts.version = v.into();
to_parts.headers = h.into();
http_types::Request::from_parts(to_parts, b)
http::Request::from_parts(to_parts, b)
}
}
#[cfg(feature = "compat")]
impl<B> From<http_types::Request<B>> for Request<B> {
fn from(from_req: http_types::Request<B>) -> Request<B> {
impl<B> From<http::Request<B>> for Request<B> {
fn from(from_req: http::Request<B>) -> Request<B> {
let (from_parts, body) = from_req.into_parts();
let mut to_req = Request::new(from_parts.method.into(), from_parts.uri.into());

View File

@@ -3,7 +3,7 @@ use std::fmt;
use std::mem::replace;
#[cfg(feature = "compat")]
use http_types;
use http;
use header::{Header, Headers};
use proto::{MessageHead, ResponseHead, Body};
@@ -148,8 +148,8 @@ impl fmt::Debug for Response {
}
#[cfg(feature = "compat")]
impl<B> From<http_types::Response<B>> for Response<B> {
fn from(from_res: http_types::Response<B>) -> Response<B> {
impl<B> From<http::Response<B>> for Response<B> {
fn from(from_res: http::Response<B>) -> Response<B> {
let (from_parts, body) = from_res.into_parts();
let mut to_res = Response::new();
to_res.version = from_parts.version.into();
@@ -160,14 +160,14 @@ impl<B> From<http_types::Response<B>> for Response<B> {
}
#[cfg(feature = "compat")]
impl From<Response> for http_types::Response<Body> {
fn from(mut from_res: Response) -> http_types::Response<Body> {
let (mut to_parts, ()) = http_types::Response::new(()).into_parts();
impl From<Response> for http::Response<Body> {
fn from(mut from_res: Response) -> http::Response<Body> {
let (mut to_parts, ()) = http::Response::new(()).into_parts();
to_parts.version = from_res.version().into();
to_parts.status = from_res.status().into();
let from_headers = replace(from_res.headers_mut(), Headers::new());
to_parts.headers = from_headers.into();
http_types::Response::from_parts(to_parts, from_res.body())
http::Response::from_parts(to_parts, from_res.body())
}
}