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/muxer: Remove deprecated functions #3031

Merged
merged 4 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# 0.38.0 [unreleased]

- Remove deprecated functions `StreamMuxerExt::next_{inbound,outbound}`. See [PR 3031].

- Hide `prost::Error` from public API in `FromEnvelopeError::InvalidPeerRecord` and `signed_envelope::DecodingError`. See [PR 3058].

[PR 3031]: https://github.com/libp2p/rust-libp2p/pull/3031
[PR 3058]: https://github.com/libp2p/rust-libp2p/pull/3058

# 0.37.0
Expand Down
44 changes: 0 additions & 44 deletions core/src/muxing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,6 @@ pub trait StreamMuxerExt: StreamMuxer + Sized {
Pin::new(self).poll_close(cx)
}

/// Returns a future that resolves to the next inbound `Substream` opened by the remote.
#[deprecated(
since = "0.37.0",
note = "This future violates the `StreamMuxer` contract because it doesn't call `StreamMuxer::poll`."
)]
fn next_inbound(&mut self) -> NextInbound<'_, Self> {
NextInbound(self)
}

/// Returns a future that opens a new outbound `Substream` with the remote.
#[deprecated(
since = "0.37.0",
note = "This future violates the `StreamMuxer` contract because it doesn't call `StreamMuxer::poll`."
)]
fn next_outbound(&mut self) -> NextOutbound<'_, Self> {
NextOutbound(self)
}

/// Returns a future for closing this [`StreamMuxer`].
fn close(self) -> Close<Self> {
Close(self)
Expand All @@ -185,34 +167,8 @@ pub trait StreamMuxerExt: StreamMuxer + Sized {

impl<S> StreamMuxerExt for S where S: StreamMuxer {}

pub struct NextInbound<'a, S>(&'a mut S);

pub struct NextOutbound<'a, S>(&'a mut S);

pub struct Close<S>(S);

impl<'a, S> Future for NextInbound<'a, S>
where
S: StreamMuxer + Unpin,
{
type Output = Result<S::Substream, S::Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.0.poll_inbound_unpin(cx)
}
}

impl<'a, S> Future for NextOutbound<'a, S>
where
S: StreamMuxer + Unpin,
{
type Output = Result<S::Substream, S::Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.0.poll_outbound_unpin(cx)
}
}

impl<S> Future for Close<S>
where
S: StreamMuxer + Unpin,
Expand Down