refactor(body): use HttpBody with extra bounds instead of Payload trait

This commit is contained in:
Dirkjan Ochtman
2020-04-19 21:59:52 +02:00
committed by Sean McArthur
parent 203621e3be
commit aac0e2dd57
20 changed files with 142 additions and 243 deletions

View File

@@ -1,3 +1,4 @@
use std::error::Error as StdError;
#[cfg(feature = "runtime")]
use std::time::Duration;
@@ -8,7 +9,7 @@ use h2::client::{Builder, SendRequest};
use tokio::io::{AsyncRead, AsyncWrite};
use super::{decode_content_length, ping, PipeToSendStream, SendBuf};
use crate::body::Payload;
use crate::body::HttpBody;
use crate::common::{task, Exec, Future, Never, Pin, Poll};
use crate::headers;
use crate::proto::Dispatched;
@@ -67,7 +68,8 @@ pub(crate) async fn handshake<T, B>(
) -> crate::Result<ClientTask<B>>
where
T: AsyncRead + AsyncWrite + Send + Unpin + 'static,
B: Payload,
B: HttpBody,
B::Data: Send + 'static,
{
let (h2_tx, mut conn) = Builder::default()
.initial_window_size(config.initial_stream_window_size)
@@ -167,7 +169,7 @@ where
pub(crate) struct ClientTask<B>
where
B: Payload,
B: HttpBody,
{
ping: ping::Recorder,
conn_drop_ref: ConnDropRef,
@@ -179,7 +181,9 @@ where
impl<B> Future for ClientTask<B>
where
B: Payload + 'static,
B: HttpBody + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
{
type Output = crate::Result<Dispatched>;