Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/muxing: Replace Into<io::Error> bound on StreamMuxer with std::error::Error #2710

Merged
merged 9 commits into from
Jun 24, 2022
Prev Previous commit
Next Next commit
Use map_inbound_stream helper
thomaseizinger committed Jun 23, 2022
commit 80a35b83e2b971cca8ca5659b7e148bd6ea85744
14 changes: 4 additions & 10 deletions core/src/muxing/boxed.rs
Original file line number Diff line number Diff line change
@@ -50,16 +50,10 @@ where
&self,
cx: &mut Context<'_>,
) -> Poll<Result<StreamMuxerEvent<Self::Substream>, Self::Error>> {
let event = ready!(self.inner.poll_event(cx).map_err(into_io_error)?);

match event {
StreamMuxerEvent::AddressChange(a) => {
Poll::Ready(Ok(StreamMuxerEvent::AddressChange(a)))
}
StreamMuxerEvent::InboundSubstream(s) => {
Poll::Ready(Ok(StreamMuxerEvent::InboundSubstream(SubstreamBox::new(s))))
}
}
let event = ready!(self.inner.poll_event(cx).map_err(into_io_error)?)
.map_inbound_stream(SubstreamBox::new);

Poll::Ready(Ok(event))
}

#[inline]