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

chore(core): remove deprecated upgrades #3867

Merged
merged 3 commits into from
May 2, 2023
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
4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
- Raise MSRV to 1.65.
See [PR 3715].

- Remove deprecated symbols related to upgrades.
See [PR 3867].

[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
[PR 3867]: https://github.com/libp2p/rust-libp2p/pull/3867

## 0.39.2

Expand Down
67 changes: 0 additions & 67 deletions core/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,13 @@ mod apply;
mod denied;
mod either;
mod error;
mod from_fn;
mod map;
mod optional;
mod pending;
mod ready;
mod select;
mod transfer;

use futures::future::Future;

#[allow(deprecated)]
pub use self::from_fn::{from_fn, FromFnUpgrade};
pub use self::{
apply::{apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply},
denied::DeniedUpgrade,
Expand All @@ -83,11 +78,7 @@ pub use self::{
transfer::{read_length_prefixed, read_varint, write_length_prefixed, write_varint},
};
pub use crate::Negotiated;
#[allow(deprecated)]
pub use map::{MapInboundUpgrade, MapInboundUpgradeErr, MapOutboundUpgrade, MapOutboundUpgradeErr};
pub use multistream_select::{NegotiatedComplete, NegotiationError, ProtocolError, Version};
#[allow(deprecated)]
pub use optional::OptionalUpgrade;

/// Types serving as protocol names.
///
Expand Down Expand Up @@ -164,35 +155,6 @@ pub trait InboundUpgrade<C>: UpgradeInfo {
fn upgrade_inbound(self, socket: C, info: Self::Info) -> Self::Future;
}

/// Extension trait for `InboundUpgrade`. Automatically implemented on all types that implement
/// `InboundUpgrade`.
#[deprecated(
note = "Will be removed without replacement because it is not used within rust-libp2p."
)]
#[allow(deprecated)]
pub trait InboundUpgradeExt<C>: InboundUpgrade<C> {
/// Returns a new object that wraps around `Self` and applies a closure to the `Output`.
fn map_inbound<F, T>(self, f: F) -> MapInboundUpgrade<Self, F>
where
Self: Sized,
F: FnOnce(Self::Output) -> T,
{
MapInboundUpgrade::new(self, f)
}

/// Returns a new object that wraps around `Self` and applies a closure to the `Error`.
fn map_inbound_err<F, T>(self, f: F) -> MapInboundUpgradeErr<Self, F>
where
Self: Sized,
F: FnOnce(Self::Error) -> T,
{
MapInboundUpgradeErr::new(self, f)
}
}

#[allow(deprecated)]
impl<C, U: InboundUpgrade<C>> InboundUpgradeExt<C> for U {}

/// Possible upgrade on an outbound connection or substream.
pub trait OutboundUpgrade<C>: UpgradeInfo {
/// Output after the upgrade has been successfully negotiated and the handshake performed.
Expand All @@ -208,32 +170,3 @@ pub trait OutboundUpgrade<C>: UpgradeInfo {
/// The `info` is the identifier of the protocol, as produced by `protocol_info`.
fn upgrade_outbound(self, socket: C, info: Self::Info) -> Self::Future;
}

/// Extention trait for `OutboundUpgrade`. Automatically implemented on all types that implement
/// `OutboundUpgrade`.
#[deprecated(
note = "Will be removed without replacement because it is not used within rust-libp2p."
)]
#[allow(deprecated)]
pub trait OutboundUpgradeExt<C>: OutboundUpgrade<C> {
/// Returns a new object that wraps around `Self` and applies a closure to the `Output`.
fn map_outbound<F, T>(self, f: F) -> MapOutboundUpgrade<Self, F>
where
Self: Sized,
F: FnOnce(Self::Output) -> T,
{
MapOutboundUpgrade::new(self, f)
}

/// Returns a new object that wraps around `Self` and applies a closure to the `Error`.
fn map_outbound_err<F, T>(self, f: F) -> MapOutboundUpgradeErr<Self, F>
where
Self: Sized,
F: FnOnce(Self::Error) -> T,
{
MapOutboundUpgradeErr::new(self, f)
}
}

#[allow(deprecated)]
impl<C, U: OutboundUpgrade<C>> OutboundUpgradeExt<C> for U {}
125 changes: 0 additions & 125 deletions core/src/upgrade/from_fn.rs

This file was deleted.

Loading