diff options
author | Carl Lerche <me@carllerche.com> | 2020-09-24 17:26:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-24 17:26:38 -0700 |
commit | cf025ba45f68934ae2138bb75ee2a5ee50506d1b (patch) | |
tree | 39fa03f4b063402e84da4435ebca39bd21266ad2 /tokio-test | |
parent | 4186b0aa38abbec7670d53882d5cdfd4b12add5c (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-test')
-rw-r--r-- | tokio-test/src/io.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio-test/src/io.rs b/tokio-test/src/io.rs index 4f0b5897..b91ddc34 100644 --- a/tokio-test/src/io.rs +++ b/tokio-test/src/io.rs @@ -200,7 +200,9 @@ impl Inner { } fn poll_action(&mut self, cx: &mut task::Context<'_>) -> Poll<Option<Action>> { - self.rx.poll_recv(cx) + use futures_core::stream::Stream; + + Pin::new(&mut self.rx).poll_next(cx) } fn read(&mut self, dst: &mut ReadBuf<'_>) -> io::Result<()> { |