pub struct Connection<TMuxer, THandler>{ /* private fields */ }
Expand description
A multiplexed connection to a peer with an associated ConnectionHandler
.
Implementations§
Source§impl<TMuxer, THandler> Connection<TMuxer, THandler>
impl<TMuxer, THandler> Connection<TMuxer, THandler>
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§
Source§impl<TMuxer, THandler> Debug for Connection<TMuxer, THandler>
impl<TMuxer, THandler> Debug for Connection<TMuxer, THandler>
impl<TMuxer, THandler> Unpin for Connection<TMuxer, THandler>
Auto Trait Implementations§
impl<TMuxer, THandler> Freeze for Connection<TMuxer, THandler>where
THandler: Freeze,
<THandler as ConnectionHandler>::OutboundOpenInfo: Freeze,
<TMuxer as StreamMuxer>::OutboundSubstream: Freeze,
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: Sync + Send,
<THandler as ConnectionHandler>::OutboundOpenInfo: Send,
<TMuxer as StreamMuxer>::OutboundSubstream: Send,
impl<TMuxer, THandler> Sync for Connection<TMuxer, THandler>where
THandler: Sync,
TMuxer: Sync + Send,
<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: RefUnwindSafe + UnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more