diff --git a/src/ascii.rs b/src/ascii.rs index e1f8e03..dc7a197 100644 --- a/src/ascii.rs +++ b/src/ascii.rs @@ -85,16 +85,17 @@ where return Ok(HashMap::new()); } - // Send command - let writer = self.io.get_mut(); - writer.write_all("get".as_bytes()).await?; + let mut bf = Vec::new(); + bf.extend(b"get"); for k in keys { - writer.write_all(b" ").await?; - writer.write_all(k.as_ref()).await?; + bf.extend(b" "); + bf.extend(k.as_ref()); } - writer.write_all(b"\r\n").await?; + bf.extend(b"\r\n"); + // Send command + let writer = self.io.get_mut(); + writer.write_all(&bf).await?; writer.flush().await?; - // Read response header self.read_many_values().await } @@ -426,7 +427,6 @@ mod tests { use futures::executor::block_on; use futures::io::{AsyncRead, AsyncWrite}; - use std::io::{Cursor, Error, ErrorKind, Read, Write}; use std::pin::Pin; use std::task::{Context, Poll};