use ConnectionError; use frame::Frame; use futures::*; pub struct PingPong { inner: T, } impl PingPong where T: Stream, T: Sink, { pub fn new(inner: T) -> PingPong { PingPong { inner: inner, } } } impl Stream for PingPong where T: Stream, T: Sink, { type Item = Frame; type Error = ConnectionError; fn poll(&mut self) -> Poll, ConnectionError> { self.inner.poll() } } impl Sink for PingPong where T: Stream, T: Sink, { type SinkItem = Frame; type SinkError = ConnectionError; fn start_send(&mut self, item: Frame) -> StartSend { self.inner.start_send(item) } fn poll_complete(&mut self) -> Poll<(), ConnectionError> { self.inner.poll_complete() } }