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/tutorial/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ let t2 = tokio::spawn(async move {
tx2.send(cmd).await.unwrap();
});
# }
````
```

At the bottom of the `main` function, we `.await` the join handles to ensure the
commands fully complete before the process exits.
Expand Down
8 changes: 3 additions & 5 deletions content/tokio/tutorial/framing.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub async fn read_frame(&mut self)
Let's break this down. The `read_frame` method operates in a loop. First,
`self.parse_frame()` is called. This will attempt to parse a redis frame from
`self.buffer`. If there is enough data to parse a frame, the frame is returned
to the caller of `read_frame()`.Otherwise, we attempt to read more data from the
to the caller of `read_frame()`. Otherwise, we attempt to read more data from the
socket into the buffer. After reading more data, `parse_frame()` is called
again. This time, if enough data has been received, parsing may succeed.

Expand Down Expand Up @@ -464,9 +464,7 @@ async fn write_frame(&mut self, frame: &Frame)
Frame::Array(_val) => unimplemented!(),
}

self.stream.flush().await;

Ok(())
self.stream.flush().await
}
# async fn write_decimal(&mut self, val: u64) -> io::Result<()> { unimplemented!() }
# }
Expand All @@ -488,7 +486,7 @@ in the buffer to the socket.

Another alternative would be to **not** call `flush()` in `write_frame()`.
Instead, provide a `flush()` function on `Connection`. This would allow the
caller to write queue multiple small frames in the write buffer then write them
caller to queue multiple small frames in the write buffer then write them
all to the socket with one `write` syscall. Doing this complicates the
`Connection` API. Simplicity is one of Mini-Redis' goals, so we decided to
include the `flush().await` call in `fn write_frame()`.
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 @@ -225,7 +225,7 @@ note: function requires argument type to outlive `'static`
|
7 | task::spawn(async {
| _________________^
8 | | println!("Here's a vector: {:?}", v);
8 | | println!("Here's a vec: {:?}", v);
9 | | });
| |_____^
help: to force the async block to take ownership of `v` (and any other
Expand Down