From d7ebe52df2b05f6c49d234f22517fc5874b0df44 Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Thu, 14 Jun 2018 17:02:29 +0200 Subject: [PATCH] Stream::Read -> Stream::Cursor --- src/response.rs | 2 +- src/stream.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/response.rs b/src/response.rs index 0a4c82d..7ddc075 100644 --- a/src/response.rs +++ b/src/response.rs @@ -249,7 +249,7 @@ impl FromStr for Response { let bytes = s.as_bytes().to_owned(); let mut cursor = Cursor::new(bytes); let mut resp = Self::do_from_read(&mut cursor)?; - resp.set_stream(Stream::Read(Box::new(cursor))); + resp.set_stream(Stream::Cursor(cursor)); Ok(resp) } } diff --git a/src/stream.rs b/src/stream.rs index 7bd12dd..551906e 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -9,7 +9,7 @@ use std::time::Duration; pub enum Stream { Http(TcpStream), Https(TlsStream), - Read(Box), + Cursor(Cursor>), #[cfg(test)] Test(Box, Vec), } @@ -29,7 +29,7 @@ impl Read for Stream { match self { Stream::Http(sock) => sock.read(buf), Stream::Https(stream) => stream.read(buf), - Stream::Read(read) => read.read(buf), + Stream::Cursor(read) => read.read(buf), #[cfg(test)] Stream::Test(reader, _) => reader.read(buf), } @@ -41,7 +41,7 @@ impl Write for Stream { match self { Stream::Http(sock) => sock.write(buf), Stream::Https(stream) => stream.write(buf), - Stream::Read(_) => panic!("Write to read stream"), + Stream::Cursor(_) => panic!("Write to read only stream"), #[cfg(test)] Stream::Test(_, writer) => writer.write(buf), } @@ -50,7 +50,7 @@ impl Write for Stream { match self { Stream::Http(sock) => sock.flush(), Stream::Https(stream) => stream.flush(), - Stream::Read(_) => panic!("Flush read stream"), + Stream::Cursor(_) => panic!("Flush read only stream"), #[cfg(test)] Stream::Test(_, writer) => writer.flush(), }