Struct mpmc_async::Sender
source · 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>
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