summaryrefslogtreecommitdiffstats
path: root/tokio/src/stream
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-09-24 17:26:38 -0700
committerGitHub <noreply@github.com>2020-09-24 17:26:38 -0700
commitcf025ba45f68934ae2138bb75ee2a5ee50506d1b (patch)
tree39fa03f4b063402e84da4435ebca39bd21266ad2 /tokio/src/stream
parent4186b0aa38abbec7670d53882d5cdfd4b12add5c (diff)
sync: support mpsc send with `&self` (#2861)
Updates the mpsc channel to use the intrusive waker based sempahore. This enables using `Sender` with `&self`. Instead of using `Sender::poll_ready` to ensure capacity and updating the `Sender` state, `async fn Sender::reserve()` is added. This function returns a `Permit` value representing the reserved capacity. Fixes: #2637 Refs: #2718 (intrusive waiters)
Diffstat (limited to 'tokio/src/stream')
-rw-r--r--tokio/src/stream/mod.rs4
-rw-r--r--tokio/src/stream/stream_map.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tokio/src/stream/mod.rs b/tokio/src/stream/mod.rs
index 6a99d9d8..59e1482f 100644
--- a/tokio/src/stream/mod.rs
+++ b/tokio/src/stream/mod.rs
@@ -270,8 +270,8 @@ pub trait StreamExt: Stream {
/// # #[tokio::main(basic_scheduler)]
/// async fn main() {
/// # time::pause();
- /// let (mut tx1, rx1) = mpsc::channel(10);
- /// let (mut tx2, rx2) = mpsc::channel(10);
+ /// let (tx1, rx1) = mpsc::channel(10);
+ /// let (tx2, rx2) = mpsc::channel(10);
///
/// let mut rx = rx1.merge(rx2);
///
diff --git a/tokio/src/stream/stream_map.rs b/tokio/src/stream/stream_map.rs
index 2f60ea4d..a1c80f15 100644
--- a/tokio/src/stream/stream_map.rs
+++ b/tokio/src/stream/stream_map.rs
@@ -57,8 +57,8 @@ use std::task::{Context, Poll};
///
/// #[tokio::main]
/// async fn main() {
-/// let (mut tx1, rx1) = mpsc::channel(10);
-/// let (mut tx2, rx2) = mpsc::channel(10);
+/// let (tx1, rx1) = mpsc::channel(10);
+/// let (tx2, rx2) = mpsc::channel(10);
///
/// tokio::spawn(async move {
/// tx1.send(1).await.unwrap();