mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-06 00:00:10 +02:00
fix panic in chat example (#279)
This commit is contained in:
+3
-3
@@ -216,9 +216,9 @@ impl Future for Peer {
|
|||||||
if let Some(message) = line {
|
if let Some(message) = line {
|
||||||
// Append the peer's name to the front of the line:
|
// Append the peer's name to the front of the line:
|
||||||
let mut line = self.name.clone();
|
let mut line = self.name.clone();
|
||||||
line.put(": ");
|
line.extend_from_slice(b": ");
|
||||||
line.put(&message);
|
line.extend_from_slice(&message);
|
||||||
line.put("\r\n");
|
line.extend_from_slice(b"\r\n");
|
||||||
|
|
||||||
// We're using `Bytes`, which allows zero-copy clones (by
|
// We're using `Bytes`, which allows zero-copy clones (by
|
||||||
// storing the data in an Arc internally).
|
// storing the data in an Arc internally).
|
||||||
|
|||||||
Reference in New Issue
Block a user