fix panic in chat example (#279)

This commit is contained in:
laizy
2018-04-02 09:00:40 -07:00
committed by Carl Lerche
parent 8d4be0361e
commit d8789cd379
+3 -3
View File
@@ -216,9 +216,9 @@ impl Future for Peer {
if let Some(message) = line {
// Append the peer's name to the front of the line:
let mut line = self.name.clone();
line.put(": ");
line.put(&message);
line.put("\r\n");
line.extend_from_slice(b": ");
line.extend_from_slice(&message);
line.extend_from_slice(b"\r\n");
// We're using `Bytes`, which allows zero-copy clones (by
// storing the data in an Arc internally).