Struct libp2p::core::connection::Connection [−][src]
A multiplexed connection to a peer with an associated ConnectionHandler
.
Implementations
impl<TMuxer, THandler> Connection<TMuxer, THandler> where
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>>,
TMuxer: StreamMuxer,
[src]
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>>,
TMuxer: StreamMuxer,
pub fn new(muxer: TMuxer, handler: THandler) -> Connection<TMuxer, THandler>
[src]
Builds a new Connection
from the given substream multiplexer
and connection handler.
pub fn handler(&self) -> &THandler
[src]
Returns a reference to the ConnectionHandler
pub fn handler_mut(&mut self) -> &mut THandler
[src]
Returns a mutable reference to the ConnectionHandler
pub fn inject_event(&mut self, event: <THandler as ConnectionHandler>::InEvent)
[src]
Notifies the connection handler of an event.
pub fn close(self) -> Close<TMuxer>ⓘ
[src]
Begins an orderly shutdown of the connection, returning a
Future
that resolves when connection shutdown is complete.
pub fn poll(
self: Pin<&mut Connection<TMuxer, THandler>>,
cx: &mut Context<'_>
) -> Poll<Result<Event<<THandler as ConnectionHandler>::OutEvent>, ConnectionError<<THandler as ConnectionHandler>::Error>>>
[src]
self: Pin<&mut Connection<TMuxer, THandler>>,
cx: &mut Context<'_>
) -> Poll<Result<Event<<THandler as ConnectionHandler>::OutEvent>, ConnectionError<<THandler as ConnectionHandler>::Error>>>
Polls the connection for events produced by the associated handler as a result of I/O activity on the substream multiplexer.
Trait Implementations
impl<TMuxer, THandler> Debug for Connection<TMuxer, THandler> where
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>> + Debug,
TMuxer: StreamMuxer,
[src]
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>> + Debug,
TMuxer: StreamMuxer,
impl<TMuxer, THandler> Unpin for Connection<TMuxer, THandler> where
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>>,
TMuxer: StreamMuxer,
[src]
THandler: ConnectionHandler<Substream = SubstreamRef<Arc<TMuxer>>>,
TMuxer: StreamMuxer,
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,
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,
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,
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: RefUnwindSafe + UnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + UnwindSafe,
THandler: UnwindSafe,
TMuxer: RefUnwindSafe,
<THandler as ConnectionHandler>::OutboundOpenInfo: RefUnwindSafe + UnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + 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>,