Skip to content

Commit

Permalink
sync: add mpsc::Receiver::blocking_recv_many
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Bachmann committed Sep 24, 2024
1 parent 82628b8 commit 7c4bdb4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tokio/src/sync/mpsc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ impl<T> Receiver<T> {
crate::future::block_on(self.recv())
}

#[track_caller]
#[cfg(feature = "sync")]
#[cfg_attr(docsrs, doc(alias = "recv_many_blocking"))]
pub fn blocking_recv_many(&mut self, buffer: &mut Vec<T>, limit: usize) -> usize {
crate::future::block_on(self.recv_many(buffer, limit))
}

/// Closes the receiving half of a channel without dropping it.
///
/// This prevents any further messages from being sent on the channel while
Expand Down

0 comments on commit 7c4bdb4

Please sign in to comment.