codec: change Encoder to take &Item (#1746)

Co-authored-by: Markus Westerlind <[email protected]>
This commit is contained in:
Lucio Franco
2020-03-04 15:54:41 -05:00
committed by GitHub
co-authored by Markus Westerlind
parent 1eb6131321
commit 9d4d076189
19 changed files with 59 additions and 55 deletions
+2 -4
View File
@@ -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!(