Skip to content

Commit 2530368

Browse files
committed
tweaks to doc comments
1 parent 70949a8 commit 2530368

3 files changed

Lines changed: 19 additions & 23 deletions

File tree

tokio/src/macros/join.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ macro_rules! doc {
2121
/// The supplied futures are stored inline and do not require allocating a
2222
/// `Vec`.
2323
///
24-
/// ### Fairness
24+
/// ## Runtime characteristics
2525
///
2626
/// By running all async expressions on the current task, the expressions are
2727
/// able to run **concurrently** but not in **parallel**. This means all
@@ -32,7 +32,7 @@ macro_rules! doc {
3232
///
3333
/// [`tokio::spawn`]: crate::spawn
3434
///
35-
/// # Poll Ordering
35+
/// ## Fairness
3636
///
3737
/// By default, `join!`'s generated future rotates which contained
3838
/// future is polled first whenever it is woken.
@@ -74,7 +74,7 @@ macro_rules! doc {
7474
/// }
7575
/// ```
7676
///
77-
/// Using the `biased;` mode to control polling order.
77+
/// Using the `biased;` mode to control polling order.
7878
///
7979
/// ```
8080
/// async fn do_stuff_async() {
@@ -145,11 +145,9 @@ doc! {macro_rules! join {
145145

146146
const COUNT: u32 = $($total)*;
147147

148-
// Each time the future created by poll_fn is polled,
149-
// if not running in biased mode,
150-
// a different future will be polled first
151-
// to ensure every future passed to join! gets a chance to make progress even if
152-
// one of the futures consumes the whole budget.
148+
// Each time the future created by poll_fn is polled, if not using biased mode,
149+
// a different future is polled first to ensure every future passed to join!
150+
// can make progress even if one of the futures consumes the whole budget.
153151
let mut rotator = <$rotator>::default();
154152

155153
poll_fn(move |cx| {
@@ -225,14 +223,14 @@ doc! {macro_rules! join {
225223
() => { async {}.await }
226224
}}
227225

228-
/// Rotates by one every [`Self::num_skip`] call up to COUNT - 1.
226+
/// Rotates by one each [`Self::num_skip`] call up to COUNT - 1.
229227
#[derive(Default, Debug)]
230228
pub struct Rotator<const COUNT: u32> {
231229
next: u32,
232230
}
233231

234232
impl<const COUNT: u32> Rotator<COUNT> {
235-
/// Rotates by one every [`Self::num_skip`] call up to COUNT - 1
233+
/// Rotates by one each [`Self::num_skip`] call up to COUNT - 1
236234
#[inline]
237235
pub fn num_skip(&mut self) -> u32 {
238236
let num_skip = self.next;
@@ -249,7 +247,7 @@ impl<const COUNT: u32> Rotator<COUNT> {
249247
pub struct BiasedRotator {}
250248

251249
impl BiasedRotator {
252-
/// Always returns 0
250+
/// Always returns 0.
253251
#[inline]
254252
pub fn num_skip(&mut self) -> u32 {
255253
0

tokio/src/macros/select.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ macro_rules! doc {
4747
/// the current call to `select!`. Continue from step 3.
4848
/// 6. Evaluate the `else` expression. If no else expression is provided, panic.
4949
///
50-
/// # Runtime characteristics
50+
/// ## Runtime characteristics
5151
///
5252
/// By running all async expressions on the current task, the expressions are
5353
/// able to run **concurrently** but not in **parallel**. This means all
@@ -58,7 +58,7 @@ macro_rules! doc {
5858
///
5959
/// [`tokio::spawn`]: crate::spawn
6060
///
61-
/// # Fairness
61+
/// ## Fairness
6262
///
6363
/// By default, `select!` randomly picks a branch to check first. This provides
6464
/// some level of fairness when calling `select!` in a loop with branches that
@@ -80,14 +80,14 @@ macro_rules! doc {
8080
/// always polled, and will not be ignored due to the stream being constantly
8181
/// ready.
8282
///
83-
/// # Panics
83+
/// ## Panics
8484
///
8585
/// The `select!` macro panics if all branches are disabled **and** there is no
8686
/// provided `else` branch. A branch is disabled when the provided `if`
8787
/// precondition returns `false` **or** when the pattern does not match the
8888
/// result of `<async expression>`.
8989
///
90-
/// # Cancellation safety
90+
/// ## Cancellation safety
9191
///
9292
/// When using `select!` in a loop to receive messages from multiple sources,
9393
/// you should make sure that the receive call is cancellation safe to avoid

tokio/src/macros/try_join.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ macro_rules! doc {
1919
/// The supplied futures are stored inline and do not require allocating a
2020
/// `Vec`.
2121
///
22-
/// ### Runtime characteristics
22+
/// ## Runtime characteristics
2323
///
2424
/// By running all async expressions on the current task, the expressions are
2525
/// able to run **concurrently** but not in **parallel**. This means all
@@ -30,7 +30,7 @@ macro_rules! doc {
3030
///
3131
/// [`tokio::spawn`]: crate::spawn
3232
///
33-
/// # Fairness
33+
/// ## Fairness
3434
///
3535
/// By default, `try_join!`'s generated future rotates which
3636
/// contained future is polled first whenever it is woken.
@@ -119,7 +119,7 @@ macro_rules! doc {
119119
/// }
120120
/// }
121121
/// ```
122-
/// Using the `biased;` mode to control polling order.
122+
/// Using the `biased;` mode to control polling order.
123123
///
124124
/// ```
125125
/// async fn do_stuff_async() -> Result<(), &'static str> {
@@ -198,11 +198,9 @@ doc! {macro_rules! try_join {
198198

199199
const COUNT: u32 = $($total)*;
200200

201-
// Each time the future created by poll_fn is polled,
202-
// if not running in biased mode,
203-
// a different future will be polled first
204-
// to ensure every future passed to join! gets a chance to make progress even if
205-
// one of the futures consumes the whole budget.
201+
// Each time the future created by poll_fn is polled, if not using biased mode,
202+
// a different future is polled first to ensure every future passed to try_join!
203+
// can make progress even if one of the futures consumes the whole budget.
206204
let mut rotator = <$rotator>::default();
207205

208206
poll_fn(move |cx| {

0 commit comments

Comments
 (0)