pub struct Sender<T, const N: usize> { /* private fields */ }Expand description
The sending end of this batching queue
Since this is a single-producer queue, this handle cannot be cloned or shared. Dropping this handle will eventually lead to the receiver signaling that this queue has been closed.
Implementations§
Source§impl<T, const N: usize> Sender<T, N>
impl<T, const N: usize> Sender<T, N>
Sourcepub fn try_send(&mut self, value: T) -> Result<bool, TrySendError<T>>
pub fn try_send(&mut self, value: T) -> Result<bool, TrySendError<T>>
Try sending a value via the queue
This may return TrySendError::Closed in case the receiver has been
dropped (see send). Or it may return TrySendError::Full()
to hand you back the value in case it can currently not be accepted
because the queue is full.
Sourcepub fn close_batch(&mut self)
pub fn close_batch(&mut self)
Hand the current bucket over to the receiver, even if it is not full
This is a no-op if the current bucket is empty.
Sourcepub fn send(&mut self, value: T) -> SendFuture<'_, T, N> ⓘ
pub fn send(&mut self, value: T) -> SendFuture<'_, T, N> ⓘ
A future that will eventually send the value
If the channel is or has been closed, the value is dropped, just as the values that are in the queue when both ends are dropped.
The sent value will not be visible to the receiver until the current
bucket is handed over, which happens either when the bucket is full
or close_batch is called.