Struct EstablishedConnection

Source
pub struct EstablishedConnection<'a, TInEvent> { /* private fields */ }
Expand description

An established connection in a pool.

Implementations§

Source§

impl<TInEvent> EstablishedConnection<'_, TInEvent>

Source

pub fn connected(&self) -> &Connected

Source

pub fn endpoint(&self) -> &ConnectedPoint

Returns information about the connected endpoint.

Source

pub fn peer_id(&self) -> PeerId

Returns the identity of the connected peer.

Source

pub fn id(&self) -> ConnectionId

Returns the local connection ID.

Source

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.

Source

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.

Source

pub fn start_close(self)

Initiates a graceful close of the connection.

Has no effect if the connection is already closing.

Trait Implementations§

Source§

impl<TInEvent> Debug for EstablishedConnection<'_, TInEvent>
where TInEvent: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, TInEvent> Freeze for EstablishedConnection<'a, TInEvent>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,