Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/tokio/topics/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ be used as a mock:

```rust
# use tokio::io::{AsyncBufReadExt, AsyncRead, AsyncWrite, AsyncWriteExt, BufReader};
#
#
# async fn handle_connection<Reader, Writer>(
# reader: Reader,
# mut writer: Writer,
Expand Down
2 changes: 1 addition & 1 deletion content/tokio/topics/tracing-next-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down
8 changes: 4 additions & 4 deletions content/tokio/tutorial/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion content/tokio/tutorial/framing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Option<Frame>>
Expand Down
2 changes: 1 addition & 1 deletion content/tokio/tutorial/io.md
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
12 changes: 6 additions & 6 deletions content/tokio/tutorial/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -657,17 +657,17 @@ async fn action(input: Option<i32>) -> Option<String> {
#[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 => {
Expand Down
2 changes: 1 addition & 1 deletion content/tokio/tutorial/shared-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion content/tokio/tutorial/spawning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions content/tokio/tutorial/streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ pub trait Stream {
type Item;

fn poll_next(
self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<Self::Item>>;

Expand Down Expand Up @@ -324,7 +324,7 @@ struct Interval {
# type Output = ();
# fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> {
# Poll::Pending
# }
# }
# }

impl Interval {
Expand Down