-
Notifications
You must be signed in to change notification settings - Fork 511
Open
Labels
Description
Just as there is a Receiver::iter
and a Receiver::try_iter
, where a Receiver can receive multiple items at once, it would seem there should also be an interface where a Sender can send multiple items at once from a single sender.
Maybe something which looks like:
pub fn send_from_slice(&self, t: &[T]) -> Result<(), SendError<T>
pub fn send_iter(&self, t: Iter<'_, T>) -> Result<(), SendError<T>
Perhaps I'm mistaken, but an interface like this, might reduce the amount of time spent contending on any locks, or reduce the amount of times a buffer Vec
needs to realloc.
Why am I requesting this? I am working with a previously existing interface, which takes a Sender as a parameter. I'd also guess that sending in parallel would introduce overhead, and sometimes I'd like to maintain the order of when each item was sent.
Thanks!
Osteoporosis