Remove Negotiated from upgrade traits (#1388)

* Remove Negotiated from upgrade traits

* Remove import
This commit is contained in:
Pierre Krieger
2020-01-13 14:34:43 +01:00
committed by GitHub
parent ff780b5bff
commit 42a45e2630
31 changed files with 218 additions and 220 deletions

View File

@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
use crate::core::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, Negotiated};
use crate::core::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use bytes::Bytes;
use futures::prelude::*;
use std::{iter, sync::Arc};
@ -66,14 +66,14 @@ impl<F> UpgradeInfo for SimpleProtocol<F> {
impl<C, F, O, A, E> InboundUpgrade<C> for SimpleProtocol<F>
where
C: AsyncRead + AsyncWrite,
F: Fn(Negotiated<C>) -> O,
F: Fn(C) -> O,
O: Future<Output = Result<A, E>> + Unpin
{
type Output = A;
type Error = E;
type Future = O;
fn upgrade_inbound(self, socket: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_inbound(self, socket: C, _: Self::Info) -> Self::Future {
let upgrade = &self.upgrade;
upgrade(socket)
}
@ -82,14 +82,14 @@ where
impl<C, F, O, A, E> OutboundUpgrade<C> for SimpleProtocol<F>
where
C: AsyncRead + AsyncWrite,
F: Fn(Negotiated<C>) -> O,
F: Fn(C) -> O,
O: Future<Output = Result<A, E>> + Unpin
{
type Output = A;
type Error = E;
type Future = O;
fn upgrade_outbound(self, socket: Negotiated<C>, _: Self::Info) -> Self::Future {
fn upgrade_outbound(self, socket: C, _: Self::Info) -> Self::Future {
let upgrade = &self.upgrade;
upgrade(socket)
}