Struct libp2p_swarm::toggle::Toggle [−][src]
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]
TBehaviour: NetworkBehaviour,
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.
fn new_handler(&mut self) -> Self::ProtocolsHandler
[src]
fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec<Multiaddr>
[src]
fn inject_connected(&mut self, peer_id: &PeerId)
[src]
fn inject_disconnected(&mut self, peer_id: &PeerId)
[src]
fn inject_connection_established(
&mut self,
peer_id: &PeerId,
connection: &ConnectionId,
endpoint: &ConnectedPoint
)
[src]
&mut self,
peer_id: &PeerId,
connection: &ConnectionId,
endpoint: &ConnectedPoint
)
fn inject_connection_closed(
&mut self,
peer_id: &PeerId,
connection: &ConnectionId,
endpoint: &ConnectedPoint
)
[src]
&mut self,
peer_id: &PeerId,
connection: &ConnectionId,
endpoint: &ConnectedPoint
)
fn inject_event(
&mut self,
peer_id: PeerId,
connection: ConnectionId,
event: <<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent
)
[src]
&mut self,
peer_id: PeerId,
connection: ConnectionId,
event: <<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::OutEvent
)
fn inject_addr_reach_failure(
&mut self,
peer_id: Option<&PeerId>,
addr: &Multiaddr,
error: &dyn Error
)
[src]
&mut self,
peer_id: Option<&PeerId>,
addr: &Multiaddr,
error: &dyn Error
)
fn inject_dial_failure(&mut self, peer_id: &PeerId)
[src]
fn inject_new_listen_addr(&mut self, addr: &Multiaddr)
[src]
fn inject_expired_listen_addr(&mut self, addr: &Multiaddr)
[src]
fn inject_new_external_addr(&mut self, addr: &Multiaddr)
[src]
fn poll(
&mut self,
cx: &mut Context<'_>,
params: &mut impl PollParameters
) -> Poll<NetworkBehaviourAction<<<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>>
[src]
&mut self,
cx: &mut Context<'_>,
params: &mut impl PollParameters
) -> Poll<NetworkBehaviourAction<<<Self::ProtocolsHandler as IntoProtocolsHandler>::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>>
fn inject_address_change(
&mut self,
_: &PeerId,
_: &ConnectionId,
_old: &ConnectedPoint,
_new: &ConnectedPoint
)
[src]
&mut self,
_: &PeerId,
_: &ConnectionId,
_old: &ConnectedPoint,
_new: &ConnectedPoint
)
fn inject_listener_error(
&mut self,
_id: ListenerId,
_err: &(dyn Error + 'static)
)
[src]
&mut self,
_id: ListenerId,
_err: &(dyn Error + 'static)
)
fn inject_listener_closed(
&mut self,
_id: ListenerId,
_reason: Result<(), &Error>
)
[src]
&mut self,
_id: ListenerId,
_reason: Result<(), &Error>
)
impl<TEvent, TBehaviour> NetworkBehaviourEventProcess<TEvent> for Toggle<TBehaviour> where
TBehaviour: NetworkBehaviourEventProcess<TEvent>,
[src]
TBehaviour: NetworkBehaviourEventProcess<TEvent>,
fn inject_event(&mut self, event: TEvent)
[src]
Auto Trait Implementations
impl<TBehaviour> RefUnwindSafe for Toggle<TBehaviour> where
TBehaviour: RefUnwindSafe,
TBehaviour: RefUnwindSafe,
impl<TBehaviour> Send for Toggle<TBehaviour> where
TBehaviour: Send,
TBehaviour: Send,
impl<TBehaviour> Sync for Toggle<TBehaviour> where
TBehaviour: Sync,
TBehaviour: Sync,
impl<TBehaviour> Unpin for Toggle<TBehaviour> where
TBehaviour: Unpin,
TBehaviour: Unpin,
impl<TBehaviour> UnwindSafe for Toggle<TBehaviour> where
TBehaviour: UnwindSafe,
TBehaviour: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,