From 80179f17f2312c60aa76ef7fc6e90a5b8c4b87c0 Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Fri, 12 Mar 2021 13:35:47 +0000 Subject: [PATCH 1/3] docs: add link to PollSender Signed-off-by: Zahari Dichev --- tokio/src/sync/mpsc/bounded.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index eafb8d778ae..1482eeb8607 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -314,7 +314,8 @@ impl Sender { Sender { chan } } - /// Sends a value, waiting until there is capacity. + /// Sends a value, waiting until there is capacity. In case you need a + /// polling interface, use [`PollSender`]. /// /// A successful send occurs when it is determined that the other end of the /// channel has not hung up already. An unsuccessful send would be one where @@ -332,6 +333,7 @@ impl Sender { /// /// [`close`]: Receiver::close /// [`Receiver`]: Receiver + /// [`PollSender`]: https://docs.rs/tokio-util/0.6.4/tokio_util/sync/struct.PollSender.html /// /// # Examples /// From a9b9c62448ca38c82018f3118bbb3b9823eeb7e4 Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Fri, 12 Mar 2021 14:06:56 +0000 Subject: [PATCH 2/3] feedback Signed-off-by: Zahari Dichev --- tokio/src/sync/mpsc/bounded.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index 1482eeb8607..ca10c65ff2c 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -309,13 +309,16 @@ impl fmt::Debug for Receiver { impl Unpin for Receiver {} +/// To use the `Sender` in a poll function, you can use the [`PollSender`] +/// utility. +/// +/// [`PollSender`]: https://docs.rs/tokio-util/0.6/tokio_util/sync/struct.PollSender.html impl Sender { pub(crate) fn new(chan: chan::Tx) -> Sender { Sender { chan } } - /// Sends a value, waiting until there is capacity. In case you need a - /// polling interface, use [`PollSender`]. + /// Sends a value, waiting until there is capacity. /// /// A successful send occurs when it is determined that the other end of the /// channel has not hung up already. An unsuccessful send would be one where @@ -333,7 +336,6 @@ impl Sender { /// /// [`close`]: Receiver::close /// [`Receiver`]: Receiver - /// [`PollSender`]: https://docs.rs/tokio-util/0.6.4/tokio_util/sync/struct.PollSender.html /// /// # Examples /// From 6914ae4c16f78cc99e9a9aab105685701a6cd02e Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Fri, 12 Mar 2021 14:22:09 +0000 Subject: [PATCH 3/3] move to struct Signed-off-by: Zahari Dichev --- tokio/src/sync/mpsc/bounded.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index ca10c65ff2c..760aca367d0 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -16,6 +16,11 @@ use std::task::{Context, Poll}; /// Send values to the associated `Receiver`. /// /// Instances are created by the [`channel`](channel) function. +/// +/// To use the `Sender` in a poll function, you can use the [`PollSender`] +/// utility. +/// +/// [`PollSender`]: https://docs.rs/tokio-util/0.6/tokio_util/sync/struct.PollSender.html pub struct Sender { chan: chan::Tx, } @@ -309,10 +314,6 @@ impl fmt::Debug for Receiver { impl Unpin for Receiver {} -/// To use the `Sender` in a poll function, you can use the [`PollSender`] -/// utility. -/// -/// [`PollSender`]: https://docs.rs/tokio-util/0.6/tokio_util/sync/struct.PollSender.html impl Sender { pub(crate) fn new(chan: chan::Tx) -> Sender { Sender { chan }