refactor(lib): rename http_types to http
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| use futures::{Future, Poll, Stream}; | ||||
| use http_types; | ||||
| use http; | ||||
| use tokio_service::Service; | ||||
|  | ||||
| use client::{Connect, Client, FutureResponse}; | ||||
| @@ -21,8 +21,8 @@ where C: Connect, | ||||
|       B: Stream<Error=Error> + 'static, | ||||
|       B::Item: AsRef<[u8]>, | ||||
| { | ||||
|     type Request = http_types::Request<B>; | ||||
|     type Response = http_types::Response<Body>; | ||||
|     type Request = http::Request<B>; | ||||
|     type Response = http::Response<Body>; | ||||
|     type Error = Error; | ||||
|     type Future = CompatFutureResponse; | ||||
|  | ||||
| @@ -43,7 +43,7 @@ pub fn future(fut: FutureResponse) -> CompatFutureResponse { | ||||
| } | ||||
|  | ||||
| impl Future for CompatFutureResponse { | ||||
|     type Item = http_types::Response<Body>; | ||||
|     type Item = http::Response<Body>; | ||||
|     type Error = Error; | ||||
|  | ||||
|     fn poll(&mut self) -> Poll<Self::Item, Error> { | ||||
|   | ||||
| @@ -10,7 +10,7 @@ use std::time::Duration; | ||||
| use futures::{future, Poll, Async, Future, Stream}; | ||||
| use futures::unsync::oneshot; | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
| use tokio_io::{AsyncRead, AsyncWrite}; | ||||
| use tokio::reactor::Handle; | ||||
| use tokio_proto::BindClient; | ||||
| @@ -118,7 +118,7 @@ where C: Connect, | ||||
|     /// Send an `http::Request` using this Client. | ||||
|     #[inline] | ||||
|     #[cfg(feature = "compat")] | ||||
|     pub fn request_compat(&self, req: http_types::Request<B>) -> compat::CompatFutureResponse { | ||||
|     pub fn request_compat(&self, req: http::Request<B>) -> compat::CompatFutureResponse { | ||||
|         self::compat_impl::future(self.call(req.into())) | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -83,7 +83,7 @@ use std::iter::{FromIterator, IntoIterator}; | ||||
| use std::{mem, fmt}; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| use unicase::Ascii; | ||||
|  | ||||
| @@ -552,8 +552,8 @@ impl fmt::Debug for Headers { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<http_types::HeaderMap> for Headers { | ||||
|     fn from(mut header_map: http_types::HeaderMap) -> Headers { | ||||
| impl From<http::HeaderMap> for Headers { | ||||
|     fn from(mut header_map: http::HeaderMap) -> Headers { | ||||
|         let mut headers = Headers::new(); | ||||
|         for (name, mut value_drain) in header_map.drain() { | ||||
|             if let Some(first_value) = value_drain.next() { | ||||
| @@ -569,23 +569,23 @@ impl From<http_types::HeaderMap> for Headers { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<Headers> for http_types::HeaderMap { | ||||
|     fn from(headers: Headers) -> http_types::HeaderMap { | ||||
|         let mut header_map = http_types::HeaderMap::new(); | ||||
| impl From<Headers> for http::HeaderMap { | ||||
|     fn from(headers: Headers) -> http::HeaderMap { | ||||
|         let mut header_map = http::HeaderMap::new(); | ||||
|         for header in headers.iter() { | ||||
|             let entry = header_map.entry(header.name()) | ||||
|                 .expect("attempted to convert invalid header name"); | ||||
|             let mut value_iter = header.raw().iter().map(|line| { | ||||
|                 http_types::header::HeaderValue::from_bytes(line) | ||||
|                 http::header::HeaderValue::from_bytes(line) | ||||
|                     .expect("attempted to convert invalid header value") | ||||
|             }); | ||||
|             match entry { | ||||
|                 http_types::header::Entry::Occupied(mut  occupied) => { | ||||
|                 http::header::Entry::Occupied(mut  occupied) => { | ||||
|                     for value in value_iter { | ||||
|                         occupied.append(value); | ||||
|                     } | ||||
|                 }, | ||||
|                 http_types::header::Entry::Vacant(vacant) => { | ||||
|                 http::header::Entry::Vacant(vacant) => { | ||||
|                     if let Some(first_value) = value_iter.next() { | ||||
|                         let mut occupied = vacant.insert_entry(first_value); | ||||
|                         for value in value_iter { | ||||
| @@ -996,7 +996,7 @@ mod tests { | ||||
|     #[test] | ||||
|     #[cfg(feature = "compat")] | ||||
|     fn test_compat() { | ||||
|         use http_types; | ||||
|         use http; | ||||
|  | ||||
|         let mut orig_hyper_headers = Headers::new(); | ||||
|         orig_hyper_headers.set(ContentLength(11)); | ||||
| @@ -1004,14 +1004,14 @@ mod tests { | ||||
|         orig_hyper_headers.append_raw("x-foo", b"bar".to_vec()); | ||||
|         orig_hyper_headers.append_raw("x-foo", b"quux".to_vec()); | ||||
|  | ||||
|         let mut orig_http_headers = http_types::HeaderMap::new(); | ||||
|         orig_http_headers.insert(http_types::header::CONTENT_LENGTH, "11".parse().unwrap()); | ||||
|         orig_http_headers.insert(http_types::header::HOST, "foo.bar".parse().unwrap()); | ||||
|         let mut orig_http_headers = http::HeaderMap::new(); | ||||
|         orig_http_headers.insert(http::header::CONTENT_LENGTH, "11".parse().unwrap()); | ||||
|         orig_http_headers.insert(http::header::HOST, "foo.bar".parse().unwrap()); | ||||
|         orig_http_headers.append("x-foo", "bar".parse().unwrap()); | ||||
|         orig_http_headers.append("x-foo", "quux".parse().unwrap()); | ||||
|  | ||||
|         let conv_hyper_headers: Headers = orig_http_headers.clone().into(); | ||||
|         let conv_http_headers: http_types::HeaderMap = orig_hyper_headers.clone().into(); | ||||
|         let conv_http_headers: http::HeaderMap = orig_hyper_headers.clone().into(); | ||||
|         assert_eq!(orig_hyper_headers, conv_hyper_headers); | ||||
|         assert_eq!(orig_http_headers, conv_http_headers); | ||||
|     } | ||||
|   | ||||
| @@ -22,7 +22,7 @@ extern crate bytes; | ||||
| #[macro_use] extern crate futures; | ||||
| extern crate futures_cpupool; | ||||
| #[cfg(feature = "compat")] | ||||
| extern crate http as http_types; | ||||
| extern crate http; | ||||
| extern crate httparse; | ||||
| extern crate language_tags; | ||||
| #[macro_use] extern crate log; | ||||
|   | ||||
| @@ -4,7 +4,7 @@ use std::str::FromStr; | ||||
| use std::convert::AsRef; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| use error::Error; | ||||
| use self::Method::{Options, Get, Post, Put, Delete, Head, Trace, Connect, Patch, | ||||
| @@ -160,26 +160,26 @@ impl Default for Method { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<http_types::Method> for Method { | ||||
|     fn from(method: http_types::Method) -> Method { | ||||
| impl From<http::Method> for Method { | ||||
|     fn from(method: http::Method) -> Method { | ||||
|         match method { | ||||
|             http_types::Method::GET => | ||||
|             http::Method::GET => | ||||
|                 Method::Get, | ||||
|             http_types::Method::POST => | ||||
|             http::Method::POST => | ||||
|                 Method::Post, | ||||
|             http_types::Method::PUT => | ||||
|             http::Method::PUT => | ||||
|                 Method::Put, | ||||
|             http_types::Method::DELETE => | ||||
|             http::Method::DELETE => | ||||
|                 Method::Delete, | ||||
|             http_types::Method::HEAD => | ||||
|             http::Method::HEAD => | ||||
|                 Method::Head, | ||||
|             http_types::Method::OPTIONS => | ||||
|             http::Method::OPTIONS => | ||||
|                 Method::Options, | ||||
|             http_types::Method::CONNECT => | ||||
|             http::Method::CONNECT => | ||||
|                 Method::Connect, | ||||
|             http_types::Method::PATCH => | ||||
|             http::Method::PATCH => | ||||
|                 Method::Patch, | ||||
|             http_types::Method::TRACE => | ||||
|             http::Method::TRACE => | ||||
|                 Method::Trace, | ||||
|             _ => { | ||||
|                 method.as_ref().parse() | ||||
| @@ -190,29 +190,29 @@ impl From<http_types::Method> for Method { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<Method> for http_types::Method { | ||||
|     fn from(method: Method) -> http_types::Method { | ||||
|         use http_types::HttpTryFrom; | ||||
| impl From<Method> for http::Method { | ||||
|     fn from(method: Method) -> http::Method { | ||||
|         use http::HttpTryFrom; | ||||
|  | ||||
|         match method { | ||||
|             Method::Get => | ||||
|                 http_types::Method::GET, | ||||
|                 http::Method::GET, | ||||
|             Method::Post => | ||||
|                 http_types::Method::POST, | ||||
|                 http::Method::POST, | ||||
|             Method::Put => | ||||
|                 http_types::Method::PUT, | ||||
|                 http::Method::PUT, | ||||
|             Method::Delete => | ||||
|                 http_types::Method::DELETE, | ||||
|                 http::Method::DELETE, | ||||
|             Method::Head => | ||||
|                 http_types::Method::HEAD, | ||||
|                 http::Method::HEAD, | ||||
|             Method::Options => | ||||
|                 http_types::Method::OPTIONS, | ||||
|                 http::Method::OPTIONS, | ||||
|             Method::Connect => | ||||
|                 http_types::Method::CONNECT, | ||||
|                 http::Method::CONNECT, | ||||
|             Method::Patch => | ||||
|                 http_types::Method::PATCH, | ||||
|                 http::Method::PATCH, | ||||
|             Method::Trace => | ||||
|                 http_types::Method::TRACE, | ||||
|                 http::Method::TRACE, | ||||
|             Method::Extension(s) => { | ||||
|                 HttpTryFrom::try_from(s.as_str()) | ||||
|                     .expect("attempted to convert invalid method") | ||||
| @@ -279,7 +279,7 @@ mod tests { | ||||
|     #[test] | ||||
|     #[cfg(feature = "compat")] | ||||
|     fn test_compat() { | ||||
|         use http_types::{self, HttpTryFrom}; | ||||
|         use http::{self, HttpTryFrom}; | ||||
|  | ||||
|         let methods = vec![ | ||||
|             "GET", | ||||
| @@ -289,9 +289,9 @@ mod tests { | ||||
|         ]; | ||||
|         for method in methods { | ||||
|             let orig_hyper_method = Method::from_str(method).unwrap(); | ||||
|             let orig_http_method = http_types::Method::try_from(method).unwrap(); | ||||
|             let orig_http_method = http::Method::try_from(method).unwrap(); | ||||
|             let conv_hyper_method: Method = orig_http_method.clone().into(); | ||||
|             let conv_http_method: http_types::Method = orig_hyper_method.clone().into(); | ||||
|             let conv_http_method: http::Method = orig_hyper_method.clone().into(); | ||||
|             assert_eq!(orig_hyper_method, conv_hyper_method); | ||||
|             assert_eq!(orig_http_method, conv_http_method); | ||||
|         } | ||||
|   | ||||
| @@ -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()); | ||||
|   | ||||
| @@ -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()) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| use std::io::{Error as IoError}; | ||||
|  | ||||
| use futures::{Future, Poll}; | ||||
| use http_types; | ||||
| use http; | ||||
| use tokio_service::{NewService, Service}; | ||||
|  | ||||
| use error::Error; | ||||
| @@ -17,7 +17,7 @@ pub struct CompatFuture<F> { | ||||
| } | ||||
|  | ||||
| impl<F, Bd> Future for CompatFuture<F> | ||||
|     where F: Future<Item=http_types::Response<Bd>, Error=Error> | ||||
|     where F: Future<Item=http::Response<Bd>, Error=Error> | ||||
| { | ||||
|     type Item = Response<Bd>; | ||||
|     type Error = Error; | ||||
| @@ -41,7 +41,7 @@ pub fn service<S>(service: S) -> CompatService<S> { | ||||
| } | ||||
|  | ||||
| impl<S, Bd> Service for CompatService<S> | ||||
|     where S: Service<Request=http_types::Request<Body>, Response=http_types::Response<Bd>, Error=Error> | ||||
|     where S: Service<Request=http::Request<Body>, Response=http::Response<Bd>, Error=Error> | ||||
| { | ||||
|     type Request = Request; | ||||
|     type Response = Response<Bd>; | ||||
| @@ -68,7 +68,7 @@ pub fn new_service<S>(new_service: S) -> NewCompatService<S> { | ||||
| } | ||||
|  | ||||
| impl<S, Bd> NewService for NewCompatService<S> | ||||
|     where S: NewService<Request=http_types::Request<Body>, Response=http_types::Response<Bd>, Error=Error> | ||||
|     where S: NewService<Request=http::Request<Body>, Response=http::Response<Bd>, Error=Error> | ||||
| { | ||||
|     type Request = Request; | ||||
|     type Response = Response<Bd>; | ||||
|   | ||||
| @@ -22,7 +22,7 @@ use futures::{Future, Stream, Poll, Async, Sink, StartSend, AsyncSink}; | ||||
| use futures::future::Map; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| use tokio_io::{AsyncRead, AsyncWrite}; | ||||
| use tokio::reactor::{Core, Handle, Timeout}; | ||||
| @@ -129,7 +129,7 @@ impl<B: AsRef<[u8]> + 'static> Http<B> { | ||||
|     /// See `Http::bind`. | ||||
|     #[cfg(feature = "compat")] | ||||
|     pub fn bind_compat<S, Bd>(&self, addr: &SocketAddr, new_service: S) -> ::Result<Server<compat::NewCompatService<S>, Bd>> | ||||
|         where S: NewService<Request = http_types::Request<Body>, Response = http_types::Response<Bd>, Error = ::Error> + | ||||
|         where S: NewService<Request = http::Request<Body>, Response = http::Response<Bd>, Error = ::Error> + | ||||
|                     Send + Sync + 'static, | ||||
|               Bd: Stream<Item=B, Error=::Error>, | ||||
|     { | ||||
| @@ -174,7 +174,7 @@ impl<B: AsRef<[u8]> + 'static> Http<B> { | ||||
|                                  io: I, | ||||
|                                  remote_addr: SocketAddr, | ||||
|                                  service: S) | ||||
|         where S: Service<Request = http_types::Request<Body>, Response = http_types::Response<Bd>, Error = ::Error> + 'static, | ||||
|         where S: Service<Request = http::Request<Body>, Response = http::Response<Bd>, Error = ::Error> + 'static, | ||||
|               Bd: Stream<Item=B, Error=::Error> + 'static, | ||||
|               I: AsyncRead + AsyncWrite + 'static, | ||||
|     { | ||||
|   | ||||
| @@ -3,7 +3,7 @@ use std::fmt; | ||||
| use std::cmp::Ordering; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| /// An HTTP status code (`status-code` in RFC 7230 et al.). | ||||
| /// | ||||
| @@ -600,17 +600,17 @@ impl From<StatusCode> for u16 { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<http_types::StatusCode> for StatusCode { | ||||
|     fn from(status: http_types::StatusCode) -> StatusCode { | ||||
| impl From<http::StatusCode> for StatusCode { | ||||
|     fn from(status: http::StatusCode) -> StatusCode { | ||||
|         StatusCode::try_from(status.as_u16()) | ||||
|             .expect("attempted to convert invalid status code") | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<StatusCode> for http_types::StatusCode { | ||||
|     fn from(status: StatusCode) -> http_types::StatusCode { | ||||
|         http_types::StatusCode::from_u16(status.as_u16()) | ||||
| impl From<StatusCode> for http::StatusCode { | ||||
|     fn from(status: StatusCode) -> http::StatusCode { | ||||
|         http::StatusCode::from_u16(status.as_u16()) | ||||
|             .expect("attempted to convert invalid status code") | ||||
|     } | ||||
| } | ||||
| @@ -769,12 +769,12 @@ mod tests { | ||||
|     #[test] | ||||
|     #[cfg(feature = "compat")] | ||||
|     fn test_compat() { | ||||
|         use http_types::{self, HttpTryFrom}; | ||||
|         use http::{self, HttpTryFrom}; | ||||
|         for i in 100..600 { | ||||
|             let orig_hyper_status = StatusCode::try_from(i).unwrap(); | ||||
|             let orig_http_status = http_types::StatusCode::try_from(i).unwrap(); | ||||
|             let orig_http_status = http::StatusCode::try_from(i).unwrap(); | ||||
|             let conv_hyper_status: StatusCode = orig_http_status.into(); | ||||
|             let conv_http_status: http_types::StatusCode = orig_hyper_status.into(); | ||||
|             let conv_http_status: http::StatusCode = orig_hyper_status.into(); | ||||
|             assert_eq!(orig_hyper_status, conv_hyper_status); | ||||
|             assert_eq!(orig_http_status, conv_http_status); | ||||
|         } | ||||
|   | ||||
							
								
								
									
										12
									
								
								src/uri.rs
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/uri.rs
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ use std::fmt::{Display, self}; | ||||
| use std::str::{self, FromStr}; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| use ::common::ByteStr; | ||||
| use bytes::{BufMut, Bytes, BytesMut}; | ||||
| @@ -319,18 +319,18 @@ impl Display for Uri { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<http_types::Uri> for Uri { | ||||
|     fn from(uri: http_types::Uri) -> Uri { | ||||
| impl From<http::Uri> for Uri { | ||||
|     fn from(uri: http::Uri) -> Uri { | ||||
|         uri.to_string().parse() | ||||
|             .expect("attempted to convert invalid uri") | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<Uri> for http_types::Uri { | ||||
|     fn from(uri: Uri) -> http_types::Uri { | ||||
| impl From<Uri> for http::Uri { | ||||
|     fn from(uri: Uri) -> http::Uri { | ||||
|         let bytes = uri.source.into_bytes(); | ||||
|         http_types::Uri::from_shared(bytes) | ||||
|         http::Uri::from_shared(bytes) | ||||
|             .expect("attempted to convert invalid uri") | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use std::fmt; | ||||
| use std::str::FromStr; | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| use http_types; | ||||
| use http; | ||||
|  | ||||
| use error::Error; | ||||
| use self::HttpVersion::{Http09, Http10, Http11, H2, H2c}; | ||||
| @@ -62,33 +62,33 @@ impl Default for HttpVersion { | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<http_types::Version> for HttpVersion { | ||||
|     fn from(v: http_types::Version) -> HttpVersion { | ||||
| impl From<http::Version> for HttpVersion { | ||||
|     fn from(v: http::Version) -> HttpVersion { | ||||
|         match v { | ||||
|             http_types::Version::HTTP_09 => | ||||
|             http::Version::HTTP_09 => | ||||
|                 HttpVersion::Http09, | ||||
|             http_types::Version::HTTP_10 => | ||||
|             http::Version::HTTP_10 => | ||||
|                 HttpVersion::Http10, | ||||
|             http_types::Version::HTTP_11 => | ||||
|             http::Version::HTTP_11 => | ||||
|                 HttpVersion::Http11, | ||||
|             http_types::Version::HTTP_2 => | ||||
|             http::Version::HTTP_2 => | ||||
|                 HttpVersion::H2 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "compat")] | ||||
| impl From<HttpVersion> for http_types::Version { | ||||
|     fn from(v: HttpVersion) -> http_types::Version { | ||||
| impl From<HttpVersion> for http::Version { | ||||
|     fn from(v: HttpVersion) -> http::Version { | ||||
|         match v { | ||||
|             HttpVersion::Http09 => | ||||
|                 http_types::Version::HTTP_09, | ||||
|                 http::Version::HTTP_09, | ||||
|             HttpVersion::Http10 => | ||||
|                 http_types::Version::HTTP_10, | ||||
|                 http::Version::HTTP_10, | ||||
|             HttpVersion::Http11 => | ||||
|                 http_types::Version::HTTP_11, | ||||
|                 http::Version::HTTP_11, | ||||
|             HttpVersion::H2 => | ||||
|                 http_types::Version::HTTP_2, | ||||
|                 http::Version::HTTP_2, | ||||
|             _ => panic!("attempted to convert unexpected http version") | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user