Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Send multiple items at once via one Sender #1134

Open
kimono-koans opened this issue Sep 7, 2024 · 0 comments
Open

Feature: Send multiple items at once via one Sender #1134

kimono-koans opened this issue Sep 7, 2024 · 0 comments

Comments

@kimono-koans
Copy link

kimono-koans commented Sep 7, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant