refactor(body): fix unused sync_wrapper when stream feature disabled (#2287)
This commit is contained in:
33
.github/workflows/CI.yml
vendored
33
.github/workflows/CI.yml
vendored
@@ -54,10 +54,6 @@ jobs:
|
|||||||
- rust: nightly
|
- rust: nightly
|
||||||
features: "--features nightly"
|
features: "--features nightly"
|
||||||
benches: true
|
benches: true
|
||||||
# Limit the Happy Eyeballs tests to Linux
|
|
||||||
- rust: stable
|
|
||||||
os: ubuntu-latest
|
|
||||||
features: "--features __internal_happy_eyeballs_tests"
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
@@ -85,6 +81,35 @@ jobs:
|
|||||||
command: test
|
command: test
|
||||||
args: --benches ${{ matrix.features }}
|
args: --benches ${{ matrix.features }}
|
||||||
|
|
||||||
|
features:
|
||||||
|
name: Test Feature ${{ matrix.features }}
|
||||||
|
needs: [style]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
features:
|
||||||
|
- "--features __internal_happy_eyeballs_tests"
|
||||||
|
- "--no-default-features --features tcp"
|
||||||
|
- "--no-default-features"
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: test
|
||||||
|
args: ${{ matrix.features }}
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
name: Build docs
|
name: Build docs
|
||||||
needs: [style, test]
|
needs: [style, test]
|
||||||
|
|||||||
@@ -137,6 +137,11 @@ name = "send_file"
|
|||||||
path = "examples/send_file.rs"
|
path = "examples/send_file.rs"
|
||||||
required-features = ["runtime"]
|
required-features = ["runtime"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "service_struct_impl"
|
||||||
|
path = "examples/service_struct_impl.rs"
|
||||||
|
required-features = ["runtime"]
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "single_threaded"
|
name = "single_threaded"
|
||||||
path = "examples/single_threaded.rs"
|
path = "examples/single_threaded.rs"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use futures_util::TryStreamExt;
|
|||||||
use http::HeaderMap;
|
use http::HeaderMap;
|
||||||
use http_body::{Body as HttpBody, SizeHint};
|
use http_body::{Body as HttpBody, SizeHint};
|
||||||
|
|
||||||
|
#[cfg(feature = "stream")]
|
||||||
use crate::common::sync_wrapper::SyncWrapper;
|
use crate::common::sync_wrapper::SyncWrapper;
|
||||||
use crate::common::{task, watch, Future, Never, Pin, Poll};
|
use crate::common::{task, watch, Future, Never, Pin, Poll};
|
||||||
use crate::proto::h2::ping;
|
use crate::proto::h2::ping;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
//! Or, fully written out:
|
//! Or, fully written out:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
//! # #[cfg(feature = "runtime")]
|
||||||
|
//! # mod rt {
|
||||||
//! use std::{future::Future, net::SocketAddr, pin::Pin, task::{self, Poll}};
|
//! use std::{future::Future, net::SocketAddr, pin::Pin, task::{self, Poll}};
|
||||||
//! use hyper::{service::Service, Uri};
|
//! use hyper::{service::Service, Uri};
|
||||||
//! use tokio::net::TcpStream;
|
//! use tokio::net::TcpStream;
|
||||||
@@ -50,6 +52,7 @@
|
|||||||
//! Box::pin(TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], 1337))))
|
//! Box::pin(TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], 1337))))
|
||||||
//! }
|
//! }
|
||||||
//! }
|
//! }
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! It's worth noting that for `TcpStream`s, the [`HttpConnector`][] is a
|
//! It's worth noting that for `TcpStream`s, the [`HttpConnector`][] is a
|
||||||
@@ -59,11 +62,14 @@
|
|||||||
//! `Client` like this:
|
//! `Client` like this:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
//! # #[cfg(feature = "runtime")]
|
||||||
|
//! # fn rt () {
|
||||||
//! # let connector = hyper::client::HttpConnector::new();
|
//! # let connector = hyper::client::HttpConnector::new();
|
||||||
//! // let connector = ...
|
//! // let connector = ...
|
||||||
//!
|
//!
|
||||||
//! let client = hyper::Client::builder()
|
//! let client = hyper::Client::builder()
|
||||||
//! .build::<_, hyper::Body>(connector);
|
//! .build::<_, hyper::Body>(connector);
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ pub(crate) mod dispatch;
|
|||||||
mod pool;
|
mod pool;
|
||||||
pub mod service;
|
pub mod service;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
#[cfg(feature = "runtime")]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
/// A Client to make outgoing HTTP requests.
|
/// A Client to make outgoing HTTP requests.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ pub(crate) mod exec;
|
|||||||
pub(crate) mod io;
|
pub(crate) mod io;
|
||||||
mod lazy;
|
mod lazy;
|
||||||
mod never;
|
mod never;
|
||||||
|
#[cfg(feature = "stream")]
|
||||||
pub(crate) mod sync_wrapper;
|
pub(crate) mod sync_wrapper;
|
||||||
pub(crate) mod task;
|
pub(crate) mod task;
|
||||||
pub(crate) mod watch;
|
pub(crate) mod watch;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
//! ## Example
|
//! ## Example
|
||||||
//! A simple example that uses the `Http` struct to talk HTTP over a Tokio TCP stream
|
//! A simple example that uses the `Http` struct to talk HTTP over a Tokio TCP stream
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
|
//! # #[cfg(feature = "runtime")]
|
||||||
|
//! # mod rt {
|
||||||
//! use http::{Request, Response, StatusCode};
|
//! use http::{Request, Response, StatusCode};
|
||||||
//! use hyper::{server::conn::Http, service::service_fn, Body};
|
//! use hyper::{server::conn::Http, service::service_fn, Body};
|
||||||
//! use std::{net::SocketAddr, convert::Infallible};
|
//! use std::{net::SocketAddr, convert::Infallible};
|
||||||
@@ -38,6 +40,7 @@
|
|||||||
//! async fn hello(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
//! async fn hello(_req: Request<Body>) -> Result<Response<Body>, Infallible> {
|
||||||
//! Ok(Response::new(Body::from("Hello World!")))
|
//! Ok(Response::new(Body::from("Hello World!")))
|
||||||
//! }
|
//! }
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use std::error::Error as StdError;
|
use std::error::Error as StdError;
|
||||||
|
|||||||
Reference in New Issue
Block a user