[][src]Trait libp2p_core::transport::Transport

pub trait Transport {
    type Output;
    type Error: Error;
    type Listener: Stream<Item = (Self::ListenerUpgrade, Multiaddr), Error = Self::Error>;
    type ListenerUpgrade: Future<Item = Self::Output, Error = Self::Error>;
    type Dial: Future<Item = Self::Output, Error = Self::Error>;
    fn listen_on(
        self,
        addr: Multiaddr
    ) -> Result<(Self::Listener, Multiaddr), TransportError<Self::Error>>
    where
        Self: Sized
;
fn dial(
        self,
        addr: Multiaddr
    ) -> Result<Self::Dial, TransportError<Self::Error>>
    where
        Self: Sized
;
fn nat_traversal(
        &self,
        server: &Multiaddr,
        observed: &Multiaddr
    ) -> Option<Multiaddr>; fn boxed(self) -> Boxed<Self::Output, Self::Error>
    where
        Self: Sized + Clone + Send + Sync + 'static,
        Self::Dial: Send + 'static,
        Self::Listener: Send + 'static,
        Self::ListenerUpgrade: Send + 'static
, { ... }
fn map<F, O>(self, map: F) -> Map<Self, F>
    where
        Self: Sized,
        F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
, { ... }
fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F>
    where
        Self: Sized,
        F: FnOnce(Self::Error) -> TNewErr + Clone
, { ... }
fn or_transport<T>(self, other: T) -> OrTransport<Self, T>
    where
        Self: Sized
, { ... }
fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U>
    where
        Self: Sized,
        Self::Output: AsyncRead + AsyncWrite,
        U: InboundUpgrade<Self::Output, Output = O, Error = E>,
        U: OutboundUpgrade<Self::Output, Output = O, Error = E>
, { ... }
fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C>
    where
        Self: Sized,
        C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
        F: IntoFuture<Item = O>
, { ... }
fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self>
    where
        Self: Sized
, { ... }
fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>
    where
        Self: Sized
, { ... }
fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>
    where
        Self: Sized
, { ... } }

A transport is an object that can be used to produce connections by listening or dialing a peer.

This trait is implemented on concrete transports (e.g. TCP, UDP, etc.), but also on wrappers around them.

Note: The methods of this trait use self and not &self or &mut self. In other words, listening or dialing consumes the transport object. This has been designed so that you would implement this trait on &Foo or &mut Foo instead of directly on Foo.

Associated Types

type Output

The raw connection to a peer.

type Error: Error

Error that can happen when dialing or listening.

type Listener: Stream<Item = (Self::ListenerUpgrade, Multiaddr), Error = Self::Error>

The listener produces incoming connections.

An item should be produced whenever a connection is received at the lowest level of the transport stack. The item is a Future that is signalled once some pre-processing has taken place, and that connection has been upgraded to the wanted protocols.

type ListenerUpgrade: Future<Item = Self::Output, Error = Self::Error>

After a connection has been received, we may need to do some asynchronous pre-processing on it (e.g. an intermediary protocol negotiation). While this pre-processing takes place, we want to be able to continue polling on the listener.

type Dial: Future<Item = Self::Output, Error = Self::Error>

A future which indicates that we are currently dialing to a peer.

Loading content...

Required methods

fn listen_on(
    self,
    addr: Multiaddr
) -> Result<(Self::Listener, Multiaddr), TransportError<Self::Error>> where
    Self: Sized

Listen on the given multiaddr. Returns a stream of incoming connections, plus a modified version of the Multiaddr. This new Multiaddr is the one that that should be advertised to other nodes, instead of the one passed as parameter.

Note: The reason why we need to change the Multiaddr on success is to handle situations such as turning /ip4/127.0.0.1/tcp/0 into /ip4/127.0.0.1/tcp/<actual port>.

fn dial(
    self,
    addr: Multiaddr
) -> Result<Self::Dial, TransportError<Self::Error>> where
    Self: Sized

Dial the given multi-addr.

Returns either a future which may resolve to a connection.

If MultiaddrNotSupported is returned, then caller can try another implementation of Transport if there is any. If instead an error is returned, then we assume that there is no point in trying another Transport.

fn nat_traversal(
    &self,
    server: &Multiaddr,
    observed: &Multiaddr
) -> Option<Multiaddr>

Takes a multiaddress we're listening on (server), and tries to convert it to an externally-visible multiaddress. In order to do so, we pass an observed address which a remote node observes for one of our dialers.

For example, if server is /ip4/0.0.0.0/tcp/3000 and observed is /ip4/80.81.82.83/tcp/29601, then we should return /ip4/80.81.82.83/tcp/3000.

Each implementation of Transport is only responsible for handling the protocols it supports and should only consider the prefix of observed necessary to perform the address translation (e.g. /ip4/80.81.82.83) but should otherwise preserve server as is.

Returns None if nothing can be determined. This happens if this trait implementation doesn't recognize the protocols, or if server and observed are not related.

Loading content...

Provided methods

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 

Turns this Transport into an abstract boxed transport.

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone

Applies a function on the output of the Transport.

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone

Applies a function on the errors generated by the futures of the Transport.

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized

Builds a new struct that implements Transport that contains both self and other.

The returned object will redirect its calls to self, except that if listen_on or dial return an error then other will be tried.

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 

Wraps this transport inside an upgrade. Whenever a connection that uses this transport is established, it is wrapped inside the upgrade.

Note: The concept of an upgrade for example includes middlewares such secio (communication encryption), multiplex, but also a protocol handler.

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 

Wraps this transport inside an upgrade. Whenever a connection that uses this transport is established, it is wrapped inside the upgrade.

Note: The concept of an upgrade for example includes middlewares such secio (communication encryption), multiplex, but also a protocol handler.

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized

Adds a timeout to the connection and upgrade steps for all the sockets created by the transport.

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized

Adds a timeout to the connection and upgrade steps for all the outgoing sockets created by the transport.

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized

Adds a timeout to the connection and upgrade steps for all the incoming sockets created by the transport.

Loading content...

Implementors

impl<A, B> Transport for OrTransport<A, B> where
    B: Transport,
    A: Transport
[src]

type Output = EitherOutput<A::Output, B::Output>

type Error = EitherError<A::Error, B::Error>

type Listener = EitherListenStream<A::Listener, B::Listener>

type ListenerUpgrade = EitherFuture<A::ListenerUpgrade, B::ListenerUpgrade>

type Dial = EitherFuture<A::Dial, B::Dial>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<D, U, O, TUpgrErr> Transport for Upgrade<D, U> where
    D: Transport,
    D::Output: AsyncRead + AsyncWrite,
    D::Error: 'static,
    U: InboundUpgrade<D::Output, Output = O, Error = TUpgrErr>,
    U: OutboundUpgrade<D::Output, Output = O, Error = TUpgrErr> + Clone,
    TUpgrErr: Error + Send + Sync + 'static, 
[src]

type Output = O

type Error = TransportUpgradeError<D::Error, TUpgrErr>

type Listener = ListenerStream<D::Listener, U>

type ListenerUpgrade = ListenerUpgradeFuture<D::ListenerUpgrade, U>

type Dial = DialUpgradeFuture<D::Dial, U>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<InnerTrans> Transport for TransportTimeout<InnerTrans> where
    InnerTrans: Transport,
    InnerTrans::Error: 'static, 
[src]

type Output = InnerTrans::Output

type Error = TransportTimeoutError<InnerTrans::Error>

type Listener = TimeoutListener<InnerTrans::Listener>

type ListenerUpgrade = TokioTimerMapErr<Timeout<InnerTrans::ListenerUpgrade>>

type Dial = TokioTimerMapErr<Timeout<InnerTrans::Dial>>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<O, E> Transport for Boxed<O, E> where
    E: Error
[src]

type Output = O

type Error = E

type Listener = Listener<O, E>

type ListenerUpgrade = ListenerUpgrade<O, E>

type Dial = Dial<O, E>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<T, C, F, O> Transport for AndThen<T, C> where
    T: Transport,
    C: FnOnce(T::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>,
    F::Error: Error
[src]

type Output = O

type Error = EitherError<T::Error, F::Error>

type Listener = AndThenStream<T::Listener, C>

type ListenerUpgrade = AndThenFuture<T::ListenerUpgrade, C, F::Future>

type Dial = AndThenFuture<T::Dial, C, F::Future>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<T, F, D> Transport for Map<T, F> where
    T: Transport,
    F: FnOnce(T::Output, ConnectedPoint) -> D + Clone
[src]

type Output = D

type Error = T::Error

type Listener = MapStream<T::Listener, F>

type ListenerUpgrade = MapFuture<T::ListenerUpgrade, F>

type Dial = MapFuture<T::Dial, F>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<T, F, TErr> Transport for MapErr<T, F> where
    T: Transport,
    F: FnOnce(T::Error) -> TErr + Clone,
    TErr: Error
[src]

type Output = T::Output

type Error = TErr

type Listener = MapErrListener<T, F>

type ListenerUpgrade = MapErrListenerUpgrade<T, F>

type Dial = MapErrDial<T, F>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<T: IntoBuf + Send + 'static> Transport for Dialer<T>
[src]

type Output = Channel<T>

type Error = MemoryTransportError

type Listener = Box<dyn Stream<Item = (Self::ListenerUpgrade, Multiaddr), Error = MemoryTransportError> + Send>

type ListenerUpgrade = FutureResult<Self::Output, MemoryTransportError>

type Dial = Box<dyn Future<Item = Self::Output, Error = MemoryTransportError> + Send>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

impl<T: IntoBuf + Send + 'static> Transport for Listener<T>
[src]

type Output = Channel<T>

type Error = MemoryTransportError

type Listener = Box<dyn Stream<Item = (Self::ListenerUpgrade, Multiaddr), Error = MemoryTransportError> + Send>

type ListenerUpgrade = FutureResult<Self::Output, MemoryTransportError>

type Dial = Box<dyn Future<Item = Self::Output, Error = MemoryTransportError> + Send>

fn boxed(self) -> Boxed<Self::Output, Self::Error> where
    Self: Sized + Clone + Send + Sync + 'static,
    Self::Dial: Send + 'static,
    Self::Listener: Send + 'static,
    Self::ListenerUpgrade: Send + 'static, 
[src]

fn map<F, O>(self, map: F) -> Map<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone
[src]

fn map_err<F, TNewErr>(self, map_err: F) -> MapErr<Self, F> where
    Self: Sized,
    F: FnOnce(Self::Error) -> TNewErr + Clone
[src]

fn or_transport<T>(self, other: T) -> OrTransport<Self, T> where
    Self: Sized
[src]

fn with_upgrade<U, O, E>(self, upgrade: U) -> Upgrade<Self, U> where
    Self: Sized,
    Self::Output: AsyncRead + AsyncWrite,
    U: InboundUpgrade<Self::Output, Output = O, Error = E>,
    U: OutboundUpgrade<Self::Output, Output = O, Error = E>, 
[src]

fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C> where
    Self: Sized,
    C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
    F: IntoFuture<Item = O>, 
[src]

fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self> where
    Self: Sized
[src]

Loading content...