refactor(body): fix unused sync_wrapper when stream feature disabled (#2287)

This commit is contained in:
Sean McArthur
2020-09-21 13:57:58 -07:00
committed by GitHub
parent aea9c52808
commit 523d66a41f
7 changed files with 46 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ use futures_util::TryStreamExt;
use http::HeaderMap;
use http_body::{Body as HttpBody, SizeHint};
#[cfg(feature = "stream")]
use crate::common::sync_wrapper::SyncWrapper;
use crate::common::{task, watch, Future, Never, Pin, Poll};
use crate::proto::h2::ping;

View File

@@ -26,6 +26,8 @@
//! Or, fully written out:
//!
//! ```
//! # #[cfg(feature = "runtime")]
//! # mod rt {
//! use std::{future::Future, net::SocketAddr, pin::Pin, task::{self, Poll}};
//! use hyper::{service::Service, Uri};
//! use tokio::net::TcpStream;
@@ -50,6 +52,7 @@
//! Box::pin(TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], 1337))))
//! }
//! }
//! # }
//! ```
//!
//! It's worth noting that for `TcpStream`s, the [`HttpConnector`][] is a
@@ -59,11 +62,14 @@
//! `Client` like this:
//!
//! ```
//! # #[cfg(feature = "runtime")]
//! # fn rt () {
//! # let connector = hyper::client::HttpConnector::new();
//! // let connector = ...
//!
//! let client = hyper::Client::builder()
//! .build::<_, hyper::Body>(connector);
//! # }
//! ```
//!
//!

View File

@@ -73,6 +73,7 @@ pub(crate) mod dispatch;
mod pool;
pub mod service;
#[cfg(test)]
#[cfg(feature = "runtime")]
mod tests;
/// A Client to make outgoing HTTP requests.

View File

@@ -13,6 +13,7 @@ pub(crate) mod exec;
pub(crate) mod io;
mod lazy;
mod never;
#[cfg(feature = "stream")]
pub(crate) mod sync_wrapper;
pub(crate) mod task;
pub(crate) mod watch;

View File

@@ -11,6 +11,8 @@
//! ## Example
//! A simple example that uses the `Http` struct to talk HTTP over a Tokio TCP stream
//! ```no_run
//! # #[cfg(feature = "runtime")]
//! # mod rt {
//! use http::{Request, Response, StatusCode};
//! use hyper::{server::conn::Http, service::service_fn, Body};
//! use std::{net::SocketAddr, convert::Infallible};
@@ -38,6 +40,7 @@
//! async fn hello(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
//! Ok(Response::new(Body::from("Hello World!")))
//! }
//! # }
//! ```
use std::error::Error as StdError;