add stream and sink proxy macros

This commit is contained in:
Oliver Gould
2017-07-24 16:40:29 +00:00
parent 9e4464e385
commit 9a95fc5eef
6 changed files with 51 additions and 130 deletions

View File

@@ -51,35 +51,9 @@ impl<T> Stream for StreamRecvClose<T>
}
}
// Proxy.
impl<T, U> Sink for StreamRecvClose<T>
where T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
T: ControlStreams,
{
type SinkItem = Frame<U>;
type SinkError = ConnectionError;
fn start_send(&mut self, item: Self::SinkItem) -> StartSend<Frame<U>, ConnectionError> {
self.inner.start_send(item)
}
fn poll_complete(&mut self) -> Poll<(), ConnectionError> {
self.inner.poll_complete()
}
}
// Proxy.
impl<T, U> ReadySink for StreamRecvClose<T>
where T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
T: ReadySink,
T: ControlStreams,
{
fn poll_ready(&mut self) -> Poll<(), ConnectionError> {
self.inner.poll_ready()
}
}
proxy_apply_settings!(StreamRecvClose);
proxy_control_flow!(StreamRecvClose);
proxy_control_streams!(StreamRecvClose);
proxy_control_ping!(StreamRecvClose);
proxy_sink!(StreamRecvClose);
proxy_ready_sink!(StreamRecvClose);