Skip to content

Commit d55ddee

Browse files
committed
tweak verbiage of try_join/join fairness examples, tweaks to formatting/import organization
1 parent bc38c87 commit d55ddee

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

tokio/src/macros/join.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ macro_rules! doc {
4545
///
4646
/// But there is an important caveat to this mode. It becomes your responsibility
4747
/// to ensure that the polling order of your futures is fair. If for example you
48-
/// are joining a stream and a shutdown future, and the stream has a
49-
/// huge volume of messages that takes a long time to finish processing per poll, you should
48+
/// are joining a long-running server future with a shutdown future, and you want to make
49+
/// sure that no new requests are dispatched following a shutdown, you should
5050
/// place the shutdown future earlier in the `join!` list to ensure that it is
5151
/// always polled, and will not be delayed due to the stream future taking a long time to return
5252
/// `Poll::Pending`.
@@ -225,8 +225,8 @@ doc! {macro_rules! join {
225225
() => { async {}.await }
226226
}}
227227

228-
#[derive(Default, Debug)]
229228
/// Rotates by one every [`Self::num_skip`] call up to COUNT - 1.
229+
#[derive(Default, Debug)]
230230
pub struct Rotator<const COUNT: u32> {
231231
next: u32,
232232
}

tokio/src/macros/support.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ cfg_macros! {
33

44
pub use std::future::poll_fn;
55

6-
// Used with `join!` and `try_join!`
7-
pub use crate::macros::join::Rotator;
8-
// Used with `join!` and `try_join!`
9-
pub use crate::macros::join::BiasedRotator;
6+
pub use crate::macros::join::{BiasedRotator, Rotator};
107

118
#[doc(hidden)]
129
pub fn thread_rng_n(n: u32) -> u32 {
@@ -28,8 +25,6 @@ cfg_macros! {
2825
Poll::Ready(())
2926
}
3027
}
31-
32-
3328
}
3429

3530
pub use std::future::{Future, IntoFuture};

tokio/src/macros/try_join.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ macro_rules! doc {
4343
///
4444
/// But there is an important caveat to this mode. It becomes your responsibility
4545
/// to ensure that the polling order of your futures is fair. If for example you
46-
/// are joining a stream and a shutdown future, and the stream has a
47-
/// huge volume of messages that takes a long time to finish processing per poll, you should
46+
/// are try_joining a long-running server future with a shutdown future, and you want to make
47+
/// sure that no new requests are dispatched following a shutdown, you should
4848
/// place the shutdown future earlier in the `try_join!` list to ensure that it is
4949
/// always polled, and will not be delayed due to the stream future taking a long time to return
5050
/// `Poll::Pending`.

0 commit comments

Comments
 (0)