pub struct WeakConnectionHandle { /* private fields */ }Expand description
A weak handle to a Connection.
A WeakConnectionHandle does not keep the connection alive: holding one will not
prevent the connection from being closed when the last Connection handle is dropped.
Use upgrade to obtain a strong Connection, and closed to wait for the
connection to be closed without keeping it alive.
Implementations§
Source§impl WeakConnectionHandle
impl WeakConnectionHandle
Sourcepub fn upgrade(&self) -> Option<Connection>
pub fn upgrade(&self) -> Option<Connection>
Attempts to upgrade this weak handle to a strong Connection.
Returns None if the connection has already been dropped.
Sourcepub fn closed(&self) -> impl Future<Output = Option<Closed>> + Send + 'static
pub fn closed(&self) -> impl Future<Output = Option<Closed>> + Send + 'static
Returns a future that resolves once the connection has been closed.
If no strong references to the Connection exist at the time this is called,
the future resolves to None. If at least one strong reference still exists at
the time of this call, the returned future is guaranteed to receive the close
event with the close reason and final connection statistics, even if all strong
references are dropped before the future is awaited.
The future does not keep the connection alive.
Trait Implementations§
Source§impl Clone for WeakConnectionHandle
impl Clone for WeakConnectionHandle
Source§fn clone(&self) -> WeakConnectionHandle
fn clone(&self) -> WeakConnectionHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for WeakConnectionHandle
impl !RefUnwindSafe for WeakConnectionHandle
impl Send for WeakConnectionHandle
impl Sync for WeakConnectionHandle
impl Unpin for WeakConnectionHandle
impl !UnwindSafe for WeakConnectionHandle
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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