summaryrefslogtreecommitdiffstats
path: root/tokio/src/stream/stream_map.rs
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/stream_map.rs
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/stream_map.rs')
-rw-r--r--tokio/src/stream/stream_map.rs4
1 files changed, 2 insertions, 2 deletions
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();