[][src]Struct libp2p_core::transport::timeout::TransportTimeout

pub struct TransportTimeout<InnerTrans> { /* fields omitted */ }

Wraps around a Transport and adds a timeout to all the incoming and outgoing connections.

The timeout includes the upgrade. There is no timeout on the listener or on stream of incoming substreams.

Methods

impl<InnerTrans> TransportTimeout<InnerTrans>
[src]

pub fn new(trans: InnerTrans, timeout: Duration) -> Self
[src]

Wraps around a Transport to add timeouts to all the sockets created by it.

pub fn with_outgoing_timeout(trans: InnerTrans, timeout: Duration) -> Self
[src]

Wraps around a Transport to add timeouts to the outgoing connections.

pub fn with_ingoing_timeout(trans: InnerTrans, timeout: Duration) -> Self
[src]

Wraps around a Transport to add timeouts to the ingoing connections.

Trait Implementations

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

type Output = InnerTrans::Output

The raw connection to a peer.

type Error = TransportTimeoutError<InnerTrans::Error>

Error that can happen when dialing or listening.

type Listener = TimeoutListener<InnerTrans::Listener>

The listener produces incoming connections. Read more

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

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. Read more

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

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

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]

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
[src]

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
[src]

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
[src]

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

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]

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

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]

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

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

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

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

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

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

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

impl<InnerTrans: Copy> Copy for TransportTimeout<InnerTrans>
[src]

impl<InnerTrans: Clone> Clone for TransportTimeout<InnerTrans>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<InnerTrans: Debug> Debug for TransportTimeout<InnerTrans>
[src]

Auto Trait Implementations

impl<InnerTrans> Send for TransportTimeout<InnerTrans> where
    InnerTrans: Send

impl<InnerTrans> Sync for TransportTimeout<InnerTrans> where
    InnerTrans: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T