Struct WeakSender
struct WeakSender<T> { ... }
A sender that does not prevent the channel from being closed.
If all Sender instances of a channel were dropped and only WeakSender
instances remain, the channel is closed.
In order to send messages, the WeakSender needs to be upgraded using
WeakSender::upgrade, which returns Option<Sender>. It returns None
if all Senders have been dropped, and otherwise it returns a Sender.
Examples
use channel;
async
Implementations
impl<T> WeakSender<T>
fn upgrade(self: &Self) -> Option<Sender<T>>Tries to convert a
WeakSenderinto aSender.This will return
Someif there are otherSenderinstances alive and the channel wasn't previously dropped, otherwiseNoneis returned.fn strong_count(self: &Self) -> usizeReturns the number of
Senderhandles.fn weak_count(self: &Self) -> usizeReturns the number of
WeakSenderhandles.
impl<T> Any for WeakSender<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for WeakSender<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for WeakSender<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> Clone for WeakSender<T>
fn clone(self: &Self) -> WeakSender<T>
impl<T> CloneToUninit for WeakSender<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> Debug for WeakSender<T>
fn fmt(self: &Self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result
impl<T> Drop for WeakSender<T>
fn drop(self: &mut Self)
impl<T> Freeze for WeakSender<T>
impl<T> From for WeakSender<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RefUnwindSafe for WeakSender<T>
impl<T> Send for WeakSender<T>
impl<T> Sync for WeakSender<T>
impl<T> ToOwned for WeakSender<T>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> Unpin for WeakSender<T>
impl<T> UnwindSafe for WeakSender<T>
impl<T, U> Into for WeakSender<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for WeakSender<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for WeakSender<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>