Struct libp2p_core::connection::Connection
source · [−]pub struct Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>>, { /* private fields */ }
Expand description
A multiplexed connection to a peer with an associated ConnectionHandler
.
Implementations
sourceimpl<TMuxer, THandler> Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>>,
impl<TMuxer, THandler> Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>>,
sourcepub fn new(muxer: TMuxer, handler: THandler) -> Self
pub fn new(muxer: TMuxer, handler: THandler) -> Self
Builds a new Connection
from the given substream multiplexer
and connection handler.
sourcepub fn handler_mut(&mut self) -> &mut THandler
pub fn handler_mut(&mut self) -> &mut THandler
Returns a mutable reference to the ConnectionHandler
sourcepub fn inject_event(&mut self, event: THandler::InEvent)
pub fn inject_event(&mut self, event: THandler::InEvent)
Notifies the connection handler of an event.
Trait Implementations
sourceimpl<TMuxer, THandler> Debug for Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>> + Debug,
impl<TMuxer, THandler> Debug for Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>> + Debug,
impl<TMuxer, THandler> Unpin for Connection<TMuxer, THandler> where
TMuxer: StreamMuxer,
THandler: ConnectionHandler<Substream = Substream<TMuxer>>,
Auto Trait Implementations
impl<TMuxer, THandler> RefUnwindSafe for Connection<TMuxer, THandler> where
THandler: RefUnwindSafe,
TMuxer: RefUnwindSafe,
<THandler as ConnectionHandler>::OutboundOpenInfo: RefUnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe,
impl<TMuxer, THandler> Send for Connection<TMuxer, THandler> where
THandler: Send,
TMuxer: Send + Sync,
<THandler as ConnectionHandler>::OutboundOpenInfo: Send,
<TMuxer as StreamMuxer>::OutboundSubstream: Send,
impl<TMuxer, THandler> Sync for Connection<TMuxer, THandler> where
THandler: Sync,
TMuxer: Send + Sync,
<THandler as ConnectionHandler>::OutboundOpenInfo: Sync,
<TMuxer as StreamMuxer>::OutboundSubstream: Sync,
impl<TMuxer, THandler> UnwindSafe for Connection<TMuxer, THandler> where
THandler: UnwindSafe,
TMuxer: RefUnwindSafe,
<THandler as ConnectionHandler>::OutboundOpenInfo: UnwindSafe + RefUnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more