pub struct Sender<T> { /* private fields */ }
Expand description
Producers messages to be read by Receivers.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub async fn send(&self, value: T) -> Result<(), SendError<T>>
pub async fn send(&self, value: T) -> Result<(), SendError<T>>
Waits until the value is sent or returns an when all receivers have been dropped.
Sourcepub fn try_send(&self, value: T) -> Result<(), TrySendError<T>>
pub fn try_send(&self, value: T) -> Result<(), TrySendError<T>>
Sends without blocking or returns an when all receivers have been dropped.
Sourcepub async fn reserve(&self) -> Result<Permit<'_, T>, ReserveError>
pub async fn reserve(&self) -> Result<Permit<'_, T>, ReserveError>
Waits until a permit is reserved or returns an when all receivers have been dropped.
Sourcepub fn try_reserve(&self) -> Result<Permit<'_, T>, TryReserveError>
pub fn try_reserve(&self) -> Result<Permit<'_, T>, TryReserveError>
Reserves a permit or returns an when all receivers have been dropped.
Sourcepub async fn reserve_many(
&self,
count: usize,
) -> Result<PermitIterator<'_, T>, ReserveError>
pub async fn reserve_many( &self, count: usize, ) -> Result<PermitIterator<'_, T>, ReserveError>
Waits until multiple Permits in the queue are reserved.
Sourcepub fn try_reserve_many(
&self,
count: usize,
) -> Result<PermitIterator<'_, T>, TryReserveError>
pub fn try_reserve_many( &self, count: usize, ) -> Result<PermitIterator<'_, T>, TryReserveError>
Reserves multiple Permits in the queue, or errors out when there’s no room.
Sourcepub async fn reserve_owned(self) -> Result<OwnedPermit<T>, ReserveError>
pub async fn reserve_owned(self) -> Result<OwnedPermit<T>, ReserveError>
Like Sender::reserve, but takes ownership of Sender
until sending is done.
Sourcepub fn try_reserve_owned(self) -> Result<OwnedPermit<T>, TrySendError<Self>>
pub fn try_reserve_owned(self) -> Result<OwnedPermit<T>, TrySendError<Self>>
Reserves a permit or returns an when all receivers have been dropped.
Trait Implementations§
Source§impl<T> Clone for Sender<T>
Cloning creates new a instance with the shared state and increases the internal reference
counter.
impl<T> Clone for Sender<T>
Cloning creates new a instance with the shared state and increases the internal reference counter.
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>where
T: Send,
impl<T> Sync for Sender<T>where
T: Send,
impl<T> Unpin for Sender<T>
impl<T> UnwindSafe for Sender<T>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more