mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
codec: change Encoder to take &Item (#1746)
Co-authored-by: Markus Westerlind <[email protected]>
This commit is contained in:
co-authored by
Markus Westerlind
parent
1eb6131321
commit
9d4d076189
+2
-4
@@ -193,9 +193,7 @@ async fn process(
|
||||
let mut lines = Framed::new(stream, LinesCodec::new());
|
||||
|
||||
// Send a prompt to the client to enter their username.
|
||||
lines
|
||||
.send(String::from("Please enter your username:"))
|
||||
.await?;
|
||||
lines.send("Please enter your username:").await?;
|
||||
|
||||
// Read the first line from the `LineCodec` stream to get the username.
|
||||
let username = match lines.next().await {
|
||||
@@ -232,7 +230,7 @@ async fn process(
|
||||
// A message was received from a peer. Send it to the
|
||||
// current user.
|
||||
Ok(Message::Received(msg)) => {
|
||||
peer.lines.send(msg).await?;
|
||||
peer.lines.send(&msg).await?;
|
||||
}
|
||||
Err(e) => {
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user