Struct tet_libp2p_core::transport::OptionalTransport[][src]

pub struct OptionalTransport<T>(_);

Transport that is possibly disabled.

An OptionalTransport<T> is a wrapper around an Option<T>. If it is disabled (read: contains None), then any attempt to dial or listen will return MultiaddrNotSupported. If it is enabled (read: contains Some), then dialing and listening will be handled by the inner transport.

Implementations

impl<T> OptionalTransport<T>[src]

pub fn some(inner: T) -> OptionalTransport<T>[src]

Builds an OptionalTransport with the given transport in an enabled state.

pub fn none() -> OptionalTransport<T>[src]

Builds a disabled OptionalTransport.

Trait Implementations

impl<T: Clone> Clone for OptionalTransport<T>[src]

impl<T: Copy> Copy for OptionalTransport<T>[src]

impl<T: Debug> Debug for OptionalTransport<T>[src]

impl<T> From<T> for OptionalTransport<T>[src]

impl<T> Transport for OptionalTransport<T> where
    T: Transport
[src]

type Output = T::Output

The result of a connection setup process, including protocol upgrades. Read more

type Error = T::Error

An error that occurred during connection setup.

type Listener = T::Listener

A stream of Outputs for inbound connections. Read more

type ListenerUpgrade = T::ListenerUpgrade

A pending Output for an inbound connection, obtained from the Listener stream. Read more

type Dial = T::Dial

A pending Output for an outbound connection, obtained from dialing. Read more

Auto Trait Implementations

impl<T> RefUnwindSafe for OptionalTransport<T> where
    T: RefUnwindSafe

impl<T> Send for OptionalTransport<T> where
    T: Send

impl<T> Sync for OptionalTransport<T> where
    T: Sync

impl<T> Unpin for OptionalTransport<T> where
    T: Unpin

impl<T> UnwindSafe for OptionalTransport<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,