refactor(mock): derive Debug for MockStream
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
use std::fmt;
|
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::io::{self, Read, Write, Cursor};
|
use std::io::{self, Read, Write, Cursor};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@@ -17,7 +16,7 @@ use solicit::http::connection::{HttpConnection, EndStream, DataChunk};
|
|||||||
use header::Headers;
|
use header::Headers;
|
||||||
use net::{NetworkStream, NetworkConnector};
|
use net::{NetworkStream, NetworkConnector};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MockStream {
|
pub struct MockStream {
|
||||||
pub read: Cursor<Vec<u8>>,
|
pub read: Cursor<Vec<u8>>,
|
||||||
pub write: Vec<u8>,
|
pub write: Vec<u8>,
|
||||||
@@ -30,12 +29,6 @@ pub struct MockStream {
|
|||||||
pub write_timeout: Cell<Option<Duration>>,
|
pub write_timeout: Cell<Option<Duration>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for MockStream {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "MockStream {{ read: {:?}, write: {:?} }}", self.read.get_ref(), self.write)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialEq for MockStream {
|
impl PartialEq for MockStream {
|
||||||
fn eq(&self, other: &MockStream) -> bool {
|
fn eq(&self, other: &MockStream) -> bool {
|
||||||
self.read.get_ref() == other.read.get_ref() && self.write == other.write
|
self.read.get_ref() == other.read.get_ref() && self.write == other.write
|
||||||
|
|||||||
Reference in New Issue
Block a user