From a437d46bee0e162951f6fd616ab8b28d9a64a10a Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 13 Dec 2017 22:49:07 -0600 Subject: [PATCH] Remove most struct level bounds on handshake types (#182) --- src/client.rs | 14 ++++++++------ src/server.rs | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/client.rs b/src/client.rs index fdab127..9d98092 100644 --- a/src/client.rs +++ b/src/client.rs @@ -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 { +pub struct Handshake { builder: Builder, - inner: MapErr, fn(io::Error) -> ::Error>, + inner: WriteAll, _marker: PhantomData, } @@ -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 { - 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"); diff --git a/src/server.rs b/src/server.rs index 298f6d2..abdbd15 100644 --- a/src/server.rs +++ b/src/server.rs @@ -13,7 +13,7 @@ use std::{convert, fmt, mem}; /// In progress H2 connection binding #[must_use = "futures do nothing unless polled"] -pub struct Handshake { +pub struct Handshake { /// SETTINGS frame that will be sent once the connection is established. settings: Settings, /// The current state of the handshake.