Skip to content

Commit

Permalink
chore(core): remove deprecated upgrades
Browse files Browse the repository at this point in the history
Related #3647.

Pull-Request: #3867.
  • Loading branch information
thomaseizinger authored May 2, 2023
1 parent 62a06f9 commit 2d81b99
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 617 deletions.
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

0 comments on commit 2d81b99

Please sign in to comment.