(&mut self, data: &[u8])
| 748 | |
| 749 | impl Write for TestStream { |
| 750 | fn write(&mut self, data: &[u8]) -> IoResult<usize> { |
| 751 | match self.write_state { |
| 752 | StreamState::Closed => Err(IoError::new(ErrorKind::BrokenPipe, "EPIPE")), |
| 753 | StreamState::Error(kind) => Err(IoError::new(kind, "whatevs")), |
| 754 | StreamState::Ready => { |
| 755 | self.write_buf.extend_from_slice(data); |
| 756 | Ok(data.len()) |
| 757 | } |
| 758 | StreamState::WouldBlock => Err(IoError::new(ErrorKind::WouldBlock, "EAGAIN")), |
| 759 | } |
| 760 | } |
| 761 | fn flush(&mut self) -> IoResult<()> { |
| 762 | Ok(()) |
| 763 | } |
no test coverage detected