Skip to content

Commit 6ee2e06

Browse files
authored
Apply markdown lint and formatting (#732)
1 parent 79fca5a commit 6ee2e06

File tree

10 files changed

+22
-31
lines changed

10 files changed

+22
-31
lines changed

content/tokio/glossary.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,12 @@ combined part is said to be "in the same task".
6161
Multiple tasks are required for parallelism, but it is possible to concurrently
6262
do multiple things on one task using tools such as `join!`.
6363

64-
[`tokio::spawn`]: https://docs.rs/tokio/1/tokio/fn.spawn.html
6564
[`Runtime::block_on`]: https://docs.rs/tokio/1/tokio/runtime/struct.Runtime.html#method.block_on
6665
[`join!`]: https://docs.rs/tokio/1/tokio/macro.join.html
6766

6867
## Spawning
6968

70-
Spawning is when the `tokio::spawn` function is used to create a new task. It
69+
Spawning is when the [`tokio::spawn`] function is used to create a new task. It
7170
can also refer to creating new thread with [`std::thread::spawn`].
7271

7372
[`tokio::spawn`]: https://docs.rs/tokio/1/tokio/fn.spawn.html

content/tokio/topics/bridging.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,12 @@ This example could be configured in many ways. For instance, you could use a
371371
the opposite direction to send a response to the spawner. When you spawn a
372372
runtime in this way, it is a type of [actor].
373373

374-
375374
[`Runtime`]: https://docs.rs/tokio/1/tokio/runtime/struct.Runtime.html
376375
[`block_on`]: https://docs.rs/tokio/1/tokio/runtime/struct.Runtime.html#method.block_on
377376
[`spawn`]: https://docs.rs/tokio/1/tokio/runtime/struct.Runtime.html#method.spawn
378377
[`spawn_blocking`]: https://docs.rs/tokio/1/tokio/task/fn.spawn_blocking.html
379378
[`multi_thread`]: https://docs.rs/tokio/1/tokio/runtime/struct.Builder.html#method.new_multi_thread
380379
[`current_thread`]: https://docs.rs/tokio/1/tokio/runtime/struct.Builder.html#method.new_current_thread
381-
[`worker_threads`]: https://docs.rs/tokio/1/tokio/runtime/struct.Builder.html#method.worker_threads
382380
[`enable_all`]: https://docs.rs/tokio/1/tokio/runtime/struct.Builder.html#method.enable_all
383381
[`JoinHandle`]: https://docs.rs/tokio/1/tokio/task/struct.JoinHandle.html
384382
[`tokio::sync::mpsc`]: https://docs.rs/tokio/1/tokio/sync/mpsc/index.html

content/tokio/topics/shutdown.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,24 @@ async fn main() {
6969

7070
## Telling things to shut down
7171

72-
When you want to tell one or more tasks to shut down, you can use [Cancellation
73-
Tokens][cancellation-tokens]. These tokens allow you to notify tasks that they
74-
should terminate themselves in response to a cancellation request, making it
72+
When you want to tell one or more tasks to shut down, you can use [Cancellation
73+
Tokens][cancellation-tokens]. These tokens allow you to notify tasks that they
74+
should terminate themselves in response to a cancellation request, making it
7575
easy to implement graceful shutdowns.
7676

77-
To share a `CancellationToken` between several tasks, you must clone it. This is due
78-
to the single ownership rule that requires that each value has a single owner. When
79-
cloning a token, you get another token that's indistinguishable from the original;
80-
if one is cancelled, then the other is also cancelled. You can make as many clones
77+
To share a `CancellationToken` between several tasks, you must clone it. This is due
78+
to the single ownership rule that requires that each value has a single owner. When
79+
cloning a token, you get another token that's indistinguishable from the original;
80+
if one is cancelled, then the other is also cancelled. You can make as many clones
8181
as you need, and when you call `cancel` on one of them, they're all cancelled.
8282

8383
Here are the steps to use `CancellationToken` in multiple tasks:
84+
8485
1. First, create a new `CancellationToken`.
8586
2. Then, create a clone of the original `CancellationToken` by calling the `clone` method on the original token. This will create a new token that can be used by another task.
8687
3. Pass the original or cloned token to the tasks that should respond to cancellation requests.
8788
4. When you want to shut down the tasks gracefully, call the `cancel` method on the original or cloned token. Any task listening to the cancellation request on the original or cloned token will be notified to shut down.
8889

89-
9090
Here is code snippet showcasing the above mentioned steps:
9191

9292
```rs
@@ -121,9 +121,9 @@ tokio::spawn(async move {
121121
task1_handle.await.unwrap()
122122
```
123123

124-
With Cancellation Tokens, you don't have to shut down a task immediately when
125-
the token is cancelled. Instead, you can run a shutdown procedure before
126-
terminating the task, such as flushing data to a file or database, or sending
124+
With Cancellation Tokens, you don't have to shut down a task immediately when
125+
the token is cancelled. Instead, you can run a shutdown procedure before
126+
terminating the task, such as flushing data to a file or database, or sending
127127
a shutdown message on a connection.
128128

129129
## Waiting for things to finish shutting down
@@ -170,7 +170,6 @@ async fn some_operation(i: u64) {
170170
[`wait`]: https://docs.rs/tokio-util/latest/tokio_util/task/task_tracker/struct.TaskTracker.html#method.wait
171171
[select]: https://docs.rs/tokio/1/tokio/macro.select.html
172172
[cancellation-tokens]: https://docs.rs/tokio-util/latest/tokio_util/sync/struct.CancellationToken.html
173-
[watch]: https://docs.rs/tokio/1/tokio/sync/watch/index.html
174173
[shutdown.rs]: https://github.com/tokio-rs/mini-redis/blob/master/src/shutdown.rs
175174
[server.rs]: https://github.com/tokio-rs/mini-redis/blob/master/src/server.rs
176175
[mini-redis]: https://github.com/tokio-rs/mini-redis/

content/tokio/topics/tracing-next-steps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ of an application’s spans and events. It can also represent "resources" that t
99
Tokio runtime has created, such as Tasks. It's essential for understanding
1010
performance issues during the development process.
1111

12-
For instance, to use tokio-console in [the mini-redis project](https://github.com/tokio-rs/mini-redis),
12+
For instance, to use tokio-console in [the mini-redis project](https://github.com/tokio-rs/mini-redis),
1313
you need to enable the `tracing` feature for the Tokio package:
1414

1515
```toml
@@ -29,7 +29,7 @@ console-subscriber = "0.1.5"
2929
```
3030

3131
Finally, in `src/bin/server.rs`, replace the call to `tracing_subscriber` with
32-
the call to `console-susbcriber`:
32+
the call to `console-subscriber`:
3333

3434
Replace this:
3535

@@ -122,7 +122,7 @@ To run an instance of Jaeger, you can use Docker:
122122
docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest
123123
```
124124

125-
You can visit the Jaeger page by going to http://localhost:16686.
125+
You can visit the Jaeger page by going to <http://localhost:16686>.
126126
It will look like this:
127127
![Jaeger UI](/img/tracing-next-steps/jaeger-first-pageload.png)
128128

content/tokio/topics/tracing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ messages.
2222
[`Event`]: https://docs.rs/tracing/latest/tracing/#events
2323

2424
You can use `tracing` to:
25+
2526
- emit distributed traces to an [OpenTelemetry] collector
2627
- debug your application with [Tokio Console]
2728
- log to [`stdout`], [a log file] or [`journald`]
@@ -88,7 +89,7 @@ If you run your application now, you may see some trace events emitted by Tokio,
8889
but you will need to modify your own application to emit traces to get the most
8990
out of `tracing`.
9091

91-
## Subscriber Configuration
92+
## Subscriber Configuration
9293

9394
In the above example, we've configured [`FmtSubscriber`] with its default
9495
configuration. However, `tracing-subscriber` also provides a number of ways to
@@ -117,7 +118,6 @@ let subscriber = tracing_subscriber::fmt()
117118
For details on the available configuration options, see [the
118119
`tracing_subscriber::fmt` documentation][fmt-cfg].
119120

120-
121121
In addition to the [`FmtSubscriber`] type from [`tracing-subscriber`], other
122122
`Subscriber`s can implement their own ways of recording `tracing` data. This
123123
includes alternative output formats, analysis and aggregation, and integration

content/tokio/tutorial/channels.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Channels"
33
---
44

55
Now that we have learned a bit about concurrency with Tokio, let's apply this on
6-
the client side. Put the server code we wrote before into an explicit binary
6+
the client side. Put the server code we wrote before into an explicit binary
77
file:
88

99
```text

content/tokio/tutorial/hello-tokio.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ completes. Historically, this is a tedious and error-prone task.
122122

123123
## Compile-time green-threading
124124

125-
Rust implements asynchronous programing using a feature called [`async/await`].
125+
Rust implements asynchronous programming using a feature called [`async/await`].
126126
Functions that perform asynchronous operations are labeled with the `async`
127127
keyword. In our example, the `connect` function is defined like this:
128128

@@ -246,4 +246,3 @@ Tokio has a lot of functionality (TCP, UDP, Unix sockets, timers, sync
246246
utilities, multiple scheduler types, etc). Not all applications need all
247247
functionality. When attempting to optimize compile time or the end application
248248
footprint, the application can decide to opt into **only** the features it uses.
249-

content/tokio/tutorial/select.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ Tokio's `oneshot::Receiver` implements `Drop` by sending a closed notification t
6767
the `Sender` half. The sender half can receive this notification and abort the
6868
in-progress operation by dropping it.
6969

70-
7170
```rust
7271
use tokio::sync::oneshot;
7372

@@ -278,7 +277,7 @@ computation.
278277

279278
# Return value
280279

281-
The `tokio::select!` macro returns the result of the evaluated `<handler>` expression.
280+
The `tokio::select!` macro returns the result of the evaluated `<handler>` expression.
282281

283282
```rust
284283
async fn computation1() -> String {

content/tokio/tutorial/shared-state.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ fine as long as contention remains low and the lock is not held across calls to
110110

111111
The process function no longer initializes a `HashMap`. Instead, it takes the
112112
shared handle to the `HashMap` as an argument. It also needs to lock the
113-
`HashMap` before using it. Remember that the value's type for the HashMap
114-
is now `Bytes` (which we can cheaply clone), so this needs to be changed
115-
as well.
113+
`HashMap` before using it. Remember that the value's type for the `HashMap` is
114+
now `Bytes` (which we can cheaply clone), so this needs to be changed as well.
116115

117116
```rust
118117
use tokio::net::TcpStream;

content/tokio/tutorial/streams.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,6 @@ stream! {
406406
[`Stream`]: https://docs.rs/futures-core/0.3/futures_core/stream/trait.Stream.html
407407
[`Future`]: https://doc.rust-lang.org/std/future/trait.Future.html
408408
[`StreamExt`]: https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html
409-
[rx]: https://docs.rs/tokio/1/tokio/sync/mpsc/struct.Receiver.html
410-
[`AsyncBufReadExt::lines()`]: https://docs.rs/tokio/1/tokio/io/trait.AsyncBufReadExt.html#method.lines
411409
[next]: https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html#method.next
412410
[`map`]: https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html#method.map
413411
[`take`]: https://docs.rs/tokio-stream/0.1/tokio_stream/trait.StreamExt.html#method.take

0 commit comments

Comments
 (0)