mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 17:21:34 +00:00
core/: Remove TInEvent and TOutEvent (#2183)
TInEvent and TOutEvent are implied through THandler and thus superflucious. Both are removed in favor of a derivation through THandler.
This commit is contained in:
@ -27,7 +27,7 @@ use crate::protocols_handler::{
|
||||
ProtocolsHandlerUpgrErr
|
||||
};
|
||||
use libp2p_core::Multiaddr;
|
||||
use std::{marker::PhantomData, task::Context, task::Poll};
|
||||
use std::{fmt::Debug, marker::PhantomData, task::Context, task::Poll};
|
||||
|
||||
/// Wrapper around a protocol handler that turns the input event into something else.
|
||||
pub struct MapInEvent<TProtoHandler, TNewIn, TMap> {
|
||||
@ -51,7 +51,7 @@ impl<TProtoHandler, TMap, TNewIn> ProtocolsHandler for MapInEvent<TProtoHandler,
|
||||
where
|
||||
TProtoHandler: ProtocolsHandler,
|
||||
TMap: Fn(TNewIn) -> Option<TProtoHandler::InEvent>,
|
||||
TNewIn: Send + 'static,
|
||||
TNewIn: Debug + Send + 'static,
|
||||
TMap: Send + 'static,
|
||||
{
|
||||
type InEvent = TNewIn;
|
||||
|
@ -27,6 +27,7 @@ use crate::protocols_handler::{
|
||||
ProtocolsHandlerUpgrErr
|
||||
};
|
||||
use libp2p_core::Multiaddr;
|
||||
use std::fmt::Debug;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
/// Wrapper around a protocol handler that turns the output event into something else.
|
||||
@ -49,7 +50,7 @@ impl<TProtoHandler, TMap, TNewOut> ProtocolsHandler for MapOutEvent<TProtoHandle
|
||||
where
|
||||
TProtoHandler: ProtocolsHandler,
|
||||
TMap: FnMut(TProtoHandler::OutEvent) -> TNewOut,
|
||||
TNewOut: Send + 'static,
|
||||
TNewOut: Debug + Send + 'static,
|
||||
TMap: Send + 'static,
|
||||
{
|
||||
type InEvent = TProtoHandler::InEvent;
|
||||
|
@ -43,7 +43,7 @@ use std::{
|
||||
cmp,
|
||||
collections::{HashMap, HashSet},
|
||||
error,
|
||||
fmt,
|
||||
fmt::{self, Debug},
|
||||
hash::Hash,
|
||||
iter::{self, FromIterator},
|
||||
task::{Context, Poll},
|
||||
@ -88,7 +88,7 @@ where
|
||||
|
||||
impl<K, H> ProtocolsHandler for MultiHandler<K, H>
|
||||
where
|
||||
K: Clone + Hash + Eq + Send + 'static,
|
||||
K: Clone + Debug + Hash + Eq + Send + 'static,
|
||||
H: ProtocolsHandler,
|
||||
H::InboundProtocol: InboundUpgradeSend,
|
||||
H::OutboundProtocol: OutboundUpgradeSend
|
||||
@ -312,7 +312,7 @@ where
|
||||
|
||||
impl<K, H> IntoProtocolsHandler for IntoMultiHandler<K, H>
|
||||
where
|
||||
K: Clone + Eq + Hash + Send + 'static,
|
||||
K: Debug + Clone + Eq + Hash + Send + 'static,
|
||||
H: IntoProtocolsHandler
|
||||
{
|
||||
type Handler = MultiHandler<K, H::Handler>;
|
||||
|
@ -28,7 +28,7 @@ use crate::protocols_handler::{
|
||||
};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use std::{error, task::Context, task::Poll, time::Duration};
|
||||
use std::{error, fmt::Debug, task::Context, task::Poll, time::Duration};
|
||||
use wasm_timer::Instant;
|
||||
|
||||
/// A `ProtocolsHandler` that opens a new substream for each request.
|
||||
@ -119,12 +119,12 @@ where
|
||||
impl<TInbound, TOutbound, TEvent> ProtocolsHandler for OneShotHandler<TInbound, TOutbound, TEvent>
|
||||
where
|
||||
TInbound: InboundUpgradeSend + Send + 'static,
|
||||
TOutbound: OutboundUpgradeSend,
|
||||
TOutbound: Debug + OutboundUpgradeSend,
|
||||
TInbound::Output: Into<TEvent>,
|
||||
TOutbound::Output: Into<TEvent>,
|
||||
TOutbound::Error: error::Error + Send + 'static,
|
||||
SubstreamProtocol<TInbound, ()>: Clone,
|
||||
TEvent: Send + 'static,
|
||||
TEvent: Debug + Send + 'static,
|
||||
{
|
||||
type InEvent = TOutbound;
|
||||
type OutEvent = TEvent;
|
||||
|
Reference in New Issue
Block a user