Remove most struct level bounds on handshake types (#182)

This commit is contained in:
Carl Lerche
2017-12-13 22:49:07 -06:00
committed by GitHub
parent 9378846da8
commit a437d46bee
2 changed files with 9 additions and 7 deletions

View File

@@ -5,20 +5,19 @@ use frame::{Headers, Pseudo, Reason, Settings, StreamId};
use proto;
use bytes::{Bytes, IntoBuf};
use futures::{Async, Future, MapErr, Poll};
use futures::{Async, Future, Poll};
use http::{uri, Request, Response, Method, Version};
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_io::io::WriteAll;
use std::fmt;
use std::io;
use std::marker::PhantomData;
/// In progress H2 connection binding
#[must_use = "futures do nothing unless polled"]
pub struct Handshake<T: AsyncRead + AsyncWrite, B: IntoBuf = Bytes> {
pub struct Handshake<T, B: IntoBuf = Bytes> {
builder: Builder,
inner: MapErr<WriteAll<T, &'static [u8]>, fn(io::Error) -> ::Error>,
inner: WriteAll<T, &'static [u8]>,
_marker: PhantomData<B>,
}
@@ -96,7 +95,7 @@ where
debug!("binding client connection");
let msg: &'static [u8] = b"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
let handshake = io::write_all(io, msg).map_err(::Error::from as _);
let handshake = io::write_all(io, msg);
Handshake {
builder,
@@ -306,7 +305,10 @@ where
type Error = ::Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
let (io, _) = try_ready!(self.inner.poll());
let res = self.inner.poll()
.map_err(::Error::from);
let (io, _) = try_ready!(res);
debug!("client connection bound");

View File

@@ -13,7 +13,7 @@ use std::{convert, fmt, mem};
/// In progress H2 connection binding
#[must_use = "futures do nothing unless polled"]
pub struct Handshake<T: AsyncRead + AsyncWrite, B: IntoBuf = Bytes> {
pub struct Handshake<T, B: IntoBuf = Bytes> {
/// SETTINGS frame that will be sent once the connection is established.
settings: Settings,
/// The current state of the handshake.