[][src]Struct libp2p_swarm::toggle::Toggle

pub struct Toggle<TBehaviour> { /* fields omitted */ }

Implementation of NetworkBehaviour that can be either in the disabled or enabled state.

The state can only be chosen at initialization.

Implementations

impl<TBehaviour> Toggle<TBehaviour>[src]

pub fn is_enabled(&self) -> bool[src]

Returns true if Toggle is enabled and false if it's disabled.

pub fn as_ref(&self) -> Option<&TBehaviour>[src]

Returns a reference to the inner NetworkBehaviour.

pub fn as_mut(&mut self) -> Option<&mut TBehaviour>[src]

Returns a mutable reference to the inner NetworkBehaviour.

Trait Implementations

impl<TBehaviour> From<Option<TBehaviour>> for Toggle<TBehaviour>[src]

impl<TBehaviour> NetworkBehaviour for Toggle<TBehaviour> where
    TBehaviour: NetworkBehaviour
[src]

type ProtocolsHandler = ToggleIntoProtoHandler<TBehaviour::ProtocolsHandler>

Handler for all the protocols the network behaviour supports.

type OutEvent = TBehaviour::OutEvent

Event generated by the NetworkBehaviour and that the swarm will report back.

impl<TEvent, TBehaviour> NetworkBehaviourEventProcess<TEvent> for Toggle<TBehaviour> where
    TBehaviour: NetworkBehaviourEventProcess<TEvent>, 
[src]

Auto Trait Implementations

impl<TBehaviour> RefUnwindSafe for Toggle<TBehaviour> where
    TBehaviour: RefUnwindSafe

impl<TBehaviour> Send for Toggle<TBehaviour> where
    TBehaviour: Send

impl<TBehaviour> Sync for Toggle<TBehaviour> where
    TBehaviour: Sync

impl<TBehaviour> Unpin for Toggle<TBehaviour> where
    TBehaviour: Unpin

impl<TBehaviour> UnwindSafe for Toggle<TBehaviour> where
    TBehaviour: 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<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, 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>,