Enum libp2p_core::muxing::StreamMuxerEvent
source · pub enum StreamMuxerEvent<T> {
InboundSubstream(T),
AddressChange(Multiaddr),
}
Expand description
Event about a connection, reported by an implementation of StreamMuxer
.
Variants§
InboundSubstream(T)
Remote has opened a new substream. Contains the substream in question.
AddressChange(Multiaddr)
Address to the remote has changed. The previous one is now obsolete.
Note: This can for example happen when using the QUIC protocol, where the two nodes can change their IP address while retaining the same QUIC connection.
Implementations§
source§impl<T> StreamMuxerEvent<T>
impl<T> StreamMuxerEvent<T>
sourcepub fn into_inbound_substream(self) -> Option<T>
pub fn into_inbound_substream(self) -> Option<T>
If self
is a StreamMuxerEvent::InboundSubstream
, returns the content. Otherwise
returns None
.
sourcepub fn map_inbound_stream<O>(
self,
map: impl FnOnce(T) -> O
) -> StreamMuxerEvent<O>
pub fn map_inbound_stream<O>(
self,
map: impl FnOnce(T) -> O
) -> StreamMuxerEvent<O>
Map the stream within StreamMuxerEvent::InboundSubstream
to a new type.
Trait Implementations§
source§impl<T: Clone> Clone for StreamMuxerEvent<T>
impl<T: Clone> Clone for StreamMuxerEvent<T>
source§fn clone(&self) -> StreamMuxerEvent<T>
fn clone(&self) -> StreamMuxerEvent<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more