diff --git a/content/tokio/topics/testing.md b/content/tokio/topics/testing.md index 58797f89..baae4b5a 100644 --- a/content/tokio/topics/testing.md +++ b/content/tokio/topics/testing.md @@ -142,7 +142,7 @@ be used as a mock: ```rust # use tokio::io::{AsyncBufReadExt, AsyncRead, AsyncWrite, AsyncWriteExt, BufReader}; -# +# # async fn handle_connection( # reader: Reader, # mut writer: Writer, diff --git a/content/tokio/topics/tracing-next-steps.md b/content/tokio/topics/tracing-next-steps.md index d6efebb4..35bf45b4 100644 --- a/content/tokio/topics/tracing-next-steps.md +++ b/content/tokio/topics/tracing-next-steps.md @@ -135,7 +135,7 @@ To set up mini-redis, we'll first need to add a few dependencies. Update your # Implements the types defined in the Otel spec opentelemetry = "0.17.0" # Integration between the tracing crate and the opentelemetry crate -tracing-opentelemetry = "0.17.2" +tracing-opentelemetry = "0.17.2" # Allows you to export data to Jaeger opentelemetry-jaeger = "0.16.0" ``` diff --git a/content/tokio/tutorial/async.md b/content/tokio/tutorial/async.md index 57216bab..74fff887 100644 --- a/content/tokio/tutorial/async.md +++ b/content/tokio/tutorial/async.md @@ -582,10 +582,10 @@ impl TaskFuture { } fn poll(&mut self, cx: &mut Context<'_>) { - // Spurious wake-ups are allowed, even after a future has - // returned `Ready`. However, polling a future which has - // already returned `Ready` is *not* allowed. For this - // reason we need to check that the future is still pending + // Spurious wake-ups are allowed, even after a future has + // returned `Ready`. However, polling a future which has + // already returned `Ready` is *not* allowed. For this + // reason we need to check that the future is still pending // before we call it. Failure to do so can lead to a panic. if self.poll.is_pending() { self.poll = self.future.as_mut().poll(cx); diff --git a/content/tokio/tutorial/framing.md b/content/tokio/tutorial/framing.md index 406a78ac..a2272d52 100644 --- a/content/tokio/tutorial/framing.md +++ b/content/tokio/tutorial/framing.md @@ -64,7 +64,7 @@ struct Connection { impl Connection { /// Read a frame from the connection. - /// + /// /// Returns `None` if EOF is reached pub async fn read_frame(&mut self) -> Result> diff --git a/content/tokio/tutorial/io.md b/content/tokio/tutorial/io.md index 7800c03d..340e6bbd 100644 --- a/content/tokio/tutorial/io.md +++ b/content/tokio/tutorial/io.md @@ -281,7 +281,7 @@ can use [`TcpStream::split`]. The task that processes the echo logic in the serv # fn dox(mut socket: TcpStream) { tokio::spawn(async move { let (mut rd, mut wr) = socket.split(); - + if io::copy(&mut rd, &mut wr).await.is_err() { eprintln!("failed to copy"); } diff --git a/content/tokio/tutorial/select.md b/content/tokio/tutorial/select.md index c27cab15..ffaea2f9 100644 --- a/content/tokio/tutorial/select.md +++ b/content/tokio/tutorial/select.md @@ -554,15 +554,15 @@ async fn action() { #[tokio::main] async fn main() { - let (mut tx, mut rx) = tokio::sync::mpsc::channel(128); + let (mut tx, mut rx) = tokio::sync::mpsc::channel(128); # tokio::spawn(async move { # let _ = tx.send(1).await; # let _ = tx.send(2).await; # }); - + let operation = action(); tokio::pin!(operation); - + loop { tokio::select! { _ = &mut operation => break, @@ -657,17 +657,17 @@ async fn action(input: Option) -> Option { #[tokio::main] async fn main() { let (mut tx, mut rx) = tokio::sync::mpsc::channel(128); - + let mut done = false; let operation = action(None); tokio::pin!(operation); - + tokio::spawn(async move { let _ = tx.send(1).await; let _ = tx.send(3).await; let _ = tx.send(2).await; }); - + loop { tokio::select! { res = &mut operation, if !done => { diff --git a/content/tokio/tutorial/shared-state.md b/content/tokio/tutorial/shared-state.md index 7be04ce1..a0cf831d 100644 --- a/content/tokio/tutorial/shared-state.md +++ b/content/tokio/tutorial/shared-state.md @@ -133,7 +133,7 @@ async fn process(socket: TcpStream, db: Db) { let mut db = db.lock().unwrap(); db.insert(cmd.key().to_string(), cmd.value().clone()); Frame::Simple("OK".to_string()) - } + } Get(cmd) => { let db = db.lock().unwrap(); if let Some(value) = db.get(cmd.key()) { diff --git a/content/tokio/tutorial/spawning.md b/content/tokio/tutorial/spawning.md index 4b282870..5997dae5 100644 --- a/content/tokio/tutorial/spawning.md +++ b/content/tokio/tutorial/spawning.md @@ -329,7 +329,7 @@ error: future cannot be sent between threads safely | 6 | tokio::spawn(async { | ^^^^^^^^^^^^ future created by async block is not `Send` - | + | ::: [..]spawn.rs:127:21 | 127 | T: Future + Send + 'static, diff --git a/content/tokio/tutorial/streams.md b/content/tokio/tutorial/streams.md index 34155d9e..c714a71d 100644 --- a/content/tokio/tutorial/streams.md +++ b/content/tokio/tutorial/streams.md @@ -284,7 +284,7 @@ pub trait Stream { type Item; fn poll_next( - self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll>; @@ -324,7 +324,7 @@ struct Interval { # type Output = (); # fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> { # Poll::Pending -# } +# } # } impl Interval {