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

feat(core): deprecate OptionalUpgrade #3806

Merged
merged 7 commits into from
Apr 26, 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 @@ -7,8 +7,12 @@
- Deprecate `{In,Out}boundUpgradeExt`, as they are not used in rust-libp2p.
See [PR 3807].

- Deprecate `OptionalUpgrade` without replacement.
See [PR 3806].

[PR 3747]: https://github.com/libp2p/rust-libp2p/pull/3747
[PR 3807]: https://github.com/libp2p/rust-libp2p/pull/3807
[PR 3806]: https://github.com/libp2p/rust-libp2p/pull/3806

## 0.39.1

Expand Down
6 changes: 3 additions & 3 deletions core/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ pub use self::{
apply::{apply, apply_inbound, apply_outbound, InboundUpgradeApply, OutboundUpgradeApply},
denied::DeniedUpgrade,
error::UpgradeError,
optional::OptionalUpgrade,
pending::PendingUpgrade,
ready::ReadyUpgrade,
select::SelectUpgrade,
transfer::{read_length_prefixed, read_varint, write_length_prefixed, write_varint},
};
pub use crate::Negotiated;
pub use multistream_select::{NegotiatedComplete, NegotiationError, ProtocolError, Version};

#[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
5 changes: 5 additions & 0 deletions core/src/upgrade/optional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

#![allow(deprecated)]

use crate::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};

/// Upgrade that can be disabled at runtime.
///
/// Wraps around an `Option<T>` and makes it available or not depending on whether it contains or
/// not an upgrade.
#[derive(Debug, Clone)]
#[deprecated(
note = "Will be removed without replacement because it is not used within rust-libp2p."
)]
pub struct OptionalUpgrade<T>(Option<T>);

impl<T> OptionalUpgrade<T> {
Expand Down