Skip to content

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

@kimono-koans

Description

@kimono-koans

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions