mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-29 17:51:35 +00:00
refactor(dcutr): reshape public API to follow naming guidelines (#3214)
With this patch, the naming of types follows the guidelines discussed in #2217.
This commit is contained in:
@ -54,12 +54,12 @@ pub enum Event {
|
||||
},
|
||||
DirectConnectionUpgradeFailed {
|
||||
remote_peer_id: PeerId,
|
||||
error: UpgradeError,
|
||||
error: Error,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum UpgradeError {
|
||||
pub enum Error {
|
||||
#[error("Failed to dial peer.")]
|
||||
Dial,
|
||||
#[error("Failed to establish substream: {0}.")]
|
||||
@ -164,7 +164,7 @@ impl Behaviour {
|
||||
.into(),
|
||||
NetworkBehaviourAction::GenerateEvent(Event::DirectConnectionUpgradeFailed {
|
||||
remote_peer_id: peer_id,
|
||||
error: UpgradeError::Dial,
|
||||
error: Error::Dial,
|
||||
})
|
||||
.into(),
|
||||
]);
|
||||
@ -236,7 +236,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
self.queued_actions.push_back(
|
||||
NetworkBehaviourAction::GenerateEvent(Event::DirectConnectionUpgradeFailed {
|
||||
remote_peer_id: event_source,
|
||||
error: UpgradeError::Handler(error),
|
||||
error: Error::Handler(error),
|
||||
})
|
||||
.into(),
|
||||
);
|
||||
@ -260,7 +260,7 @@ impl NetworkBehaviour for Behaviour {
|
||||
self.queued_actions.push_back(
|
||||
NetworkBehaviourAction::GenerateEvent(Event::DirectConnectionUpgradeFailed {
|
||||
remote_peer_id: event_source,
|
||||
error: UpgradeError::Handler(error),
|
||||
error: Error::Handler(error),
|
||||
})
|
||||
.into(),
|
||||
);
|
@ -23,7 +23,7 @@
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
pub mod behaviour;
|
||||
mod behaviour_impl; // TODO: Rename back `behaviour` once deprecation symbols are removed.
|
||||
mod handler;
|
||||
mod protocol;
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
@ -31,6 +31,35 @@ mod message_proto {
|
||||
include!(concat!(env!("OUT_DIR"), "/holepunch.pb.rs"));
|
||||
}
|
||||
|
||||
pub use behaviour_impl::Behaviour;
|
||||
pub use behaviour_impl::Error;
|
||||
pub use behaviour_impl::Event;
|
||||
pub use protocol::PROTOCOL_NAME;
|
||||
pub type InboundUpgradeError = protocol::inbound::UpgradeError;
|
||||
pub type OutboundUpgradeError = protocol::outbound::UpgradeError;
|
||||
pub mod inbound {
|
||||
pub use crate::protocol::inbound::UpgradeError;
|
||||
}
|
||||
pub mod outbound {
|
||||
pub use crate::protocol::outbound::UpgradeError;
|
||||
}
|
||||
|
||||
#[deprecated(
|
||||
since = "0.9.0",
|
||||
note = "Use `libp2p_dcutr::inbound::UpgradeError` instead.`"
|
||||
)]
|
||||
pub type InboundUpgradeError = inbound::UpgradeError;
|
||||
|
||||
#[deprecated(
|
||||
since = "0.9.0",
|
||||
note = "Use `libp2p_dcutr::outbound::UpgradeError` instead.`"
|
||||
)]
|
||||
pub type OutboundUpgradeError = outbound::UpgradeError;
|
||||
pub mod behaviour {
|
||||
#[deprecated(since = "0.9.0", note = "Use `libp2p_dcutr::Behaviour` instead.`")]
|
||||
pub type Behaviour = crate::Behaviour;
|
||||
|
||||
#[deprecated(since = "0.9.0", note = "Use `libp2p_dcutr::Event` instead.`")]
|
||||
pub type Event = crate::Event;
|
||||
|
||||
#[deprecated(since = "0.9.0", note = "Use `libp2p_dcutr::Error` instead.`")]
|
||||
pub type UpgradeError = crate::Error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user