Forward Sink through `Inspect` (closes
@@ -45,6 +45,26 @@ impl<S: Stream, F> Inspect<S, F> {
}
}
+// Forwarding impl of Sink from the underlying stream
+impl<S, F> ::sink::Sink for Inspect<S, F>
+ where S: ::sink::Sink + Stream
+{
+ type SinkItem = S::SinkItem;
+ type SinkError = S::SinkError;
+
+ fn start_send(&mut self, item: S::SinkItem) -> ::StartSend<S::SinkItem, S::SinkError> {
+ self.stream.start_send(item)
+ }
+
+ fn poll_complete(&mut self) -> Poll<(), S::SinkError> {
+ self.stream.poll_complete()
+ }
+
+ fn close(&mut self) -> Poll<(), S::SinkError> {
+ self.stream.close()
+ }
+}
+
impl<S, F> Stream for Inspect<S, F>
where S: Stream,
F: FnMut(&S::Item),
