swarm/src/behaviour: Move Toggle into swarm::behaviour (#2375)

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Benoit Verkindt
2021-12-09 03:00:47 -08:00
committed by GitHub
parent cf271bcf5a
commit dd9e0a14de
4 changed files with 9 additions and 5 deletions

View File

@ -8,9 +8,12 @@
- Update `Connection::address` on `inject_address_change` (see [PR 2362]).
- Move `swarm::Toggle` to `swarm::behaviour::Toggle` (see [PR 2375]).
[PR 2339]: https://github.com/libp2p/rust-libp2p/pull/2339
[PR 2350]: https://github.com/libp2p/rust-libp2p/pull/2350
[PR 2362]: https://github.com/libp2p/rust-libp2p/pull/2362
[PR 2375]: https://github.com/libp2p/rust-libp2p/pull/2375
# 0.32.0 [2021-11-16]

View File

@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
pub mod toggle;
use crate::dial_opts::DialOpts;
use crate::protocols_handler::{IntoProtocolsHandler, ProtocolsHandler};
use crate::{AddressRecord, AddressScore, DialError};
@ -53,12 +55,12 @@ type THandlerInEvent<THandler> =
/// ## Combinators
///
/// [`NetworkBehaviour`] combinators wrap one or more [`NetworkBehaviour`] implementations and
/// implement [`NetworkBehaviour`] themselves. Example is the [`Toggle`](crate::toggle::Toggle)
/// [`NetworkBehaviour`].
/// implement [`NetworkBehaviour`] themselves. Example is the
/// [`Toggle`](crate::behaviour::toggle::Toggle) [`NetworkBehaviour`].
///
/// ``` rust
/// # use libp2p_swarm::DummyBehaviour;
/// # use libp2p_swarm::toggle::Toggle;
/// # use libp2p_swarm::behaviour::toggle::Toggle;
/// let my_behaviour = DummyBehaviour::default();
/// let my_toggled_behaviour = Toggle::from(Some(my_behaviour));
/// ```

View File

@ -53,15 +53,14 @@
//! are supported, when to open a new outbound substream, etc.
//!
mod behaviour;
mod registry;
#[cfg(test)]
mod test;
mod upgrade;
pub mod behaviour;
pub mod dial_opts;
pub mod protocols_handler;
pub mod toggle;
pub use behaviour::{
CloseConnection, NetworkBehaviour, NetworkBehaviourAction, NetworkBehaviourEventProcess,