Struct libp2p_core::connection::EstablishedConnection
source · [−]pub struct EstablishedConnection<'a, TInEvent> { /* private fields */ }
Expand description
An established connection in a pool.
Implementations
sourceimpl<TInEvent> EstablishedConnection<'_, TInEvent>
impl<TInEvent> EstablishedConnection<'_, TInEvent>
pub fn connected(&self) -> &Connected
sourcepub fn endpoint(&self) -> &ConnectedPoint
pub fn endpoint(&self) -> &ConnectedPoint
Returns information about the connected endpoint.
sourcepub fn id(&self) -> ConnectionId
pub fn id(&self) -> ConnectionId
Returns the local connection ID.
sourcepub fn notify_handler(&mut self, event: TInEvent) -> Result<(), TInEvent>
pub fn notify_handler(&mut self, event: TInEvent) -> Result<(), TInEvent>
(Asynchronously) sends an event to the connection handler.
If the handler is not ready to receive the event, either because
it is busy or the connection is about to close, the given event
is returned with an Err
.
If execution of this method is preceded by successful execution of
poll_ready_notify_handler
without another intervening execution
of notify_handler
, it only fails if the connection is now about
to close.
sourcepub fn poll_ready_notify_handler(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), ()>>
pub fn poll_ready_notify_handler(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), ()>>
Checks if notify_handler
is ready to accept an event.
Returns Ok(())
if the handler is ready to receive an event via notify_handler
.
Returns Err(())
if the background task associated with the connection
is terminating and the connection is about to close.
sourcepub fn start_close(self)
pub fn start_close(self)
Initiates a graceful close of the connection.
Has no effect if the connection is already closing.
Trait Implementations
Auto Trait Implementations
impl<'a, TInEvent> !RefUnwindSafe for EstablishedConnection<'a, TInEvent>
impl<'a, TInEvent> Send for EstablishedConnection<'a, TInEvent> where
TInEvent: Send,
impl<'a, TInEvent> Sync for EstablishedConnection<'a, TInEvent> where
TInEvent: Send,
impl<'a, TInEvent> Unpin for EstablishedConnection<'a, TInEvent>
impl<'a, TInEvent> !UnwindSafe for EstablishedConnection<'a, TInEvent>
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