-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swarm/src/lib: Remove Deref and DerefMut impls on Swarm (#1995)
Remove `Deref` and `DerefMut` implementations previously dereferencing to the `NetworkBehaviour` on `Swarm`. Instead one can access the `NetworkBehaviour` via `Swarm::behaviour` and `Swarm::behaviour_mut`. Methods on `Swarm` can now be accessed directly, e.g. via `my_swarm.local_peer_id()`. Reasoning: Accessing the `NetworkBehaviour` of a `Swarm` through `Deref` and `DerefMut` instead of a method call is an unnecessary complication, especially for newcomers. In addition, `Swarm` is not a smart-pointer and should thus not make use of `Deref` and `DerefMut`, see documentation from the standard library below. > Deref should only be implemented for smart pointers to avoid confusion. https://doc.rust-lang.org/std/ops/trait.Deref.html
- Loading branch information
Showing
37 changed files
with
313 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.29.0 [unreleased] | ||
|
||
- Update `libp2p-swarm`. | ||
|
||
# 0.28.0 [2021-03-17] | ||
|
||
- Update `libp2p-swarm`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "libp2p-floodsub" | ||
edition = "2018" | ||
description = "Floodsub protocol for libp2p" | ||
version = "0.28.0" | ||
version = "0.29.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
license = "MIT" | ||
repository = "https://github.com/libp2p/rust-libp2p" | ||
|
@@ -14,7 +14,7 @@ cuckoofilter = "0.5.0" | |
fnv = "1.0" | ||
futures = "0.3.1" | ||
libp2p-core = { version = "0.28.0", path = "../../core" } | ||
libp2p-swarm = { version = "0.28.0", path = "../../swarm" } | ||
libp2p-swarm = { version = "0.29.0", path = "../../swarm" } | ||
log = "0.4" | ||
prost = "0.7" | ||
rand = "0.7" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.30.0 [unreleased] | ||
|
||
- Update `libp2p-swarm`. | ||
|
||
# 0.29.0 [2021-03-17] | ||
|
||
- Update `libp2p-swarm`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,15 @@ | |
name = "libp2p-gossipsub" | ||
edition = "2018" | ||
description = "Gossipsub protocol for libp2p" | ||
version = "0.29.0" | ||
version = "0.30.0" | ||
authors = ["Age Manning <[email protected]>"] | ||
license = "MIT" | ||
repository = "https://github.com/libp2p/rust-libp2p" | ||
keywords = ["peer-to-peer", "libp2p", "networking"] | ||
categories = ["network-programming", "asynchronous"] | ||
|
||
[dependencies] | ||
libp2p-swarm = { version = "0.28.0", path = "../../swarm" } | ||
libp2p-swarm = { version = "0.29.0", path = "../../swarm" } | ||
libp2p-core = { version = "0.28.0", path = "../../core" } | ||
bytes = "1.0" | ||
byteorder = "1.3.4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "libp2p-kad" | ||
edition = "2018" | ||
description = "Kademlia protocol for libp2p" | ||
version = "0.29.0" | ||
version = "0.30.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
license = "MIT" | ||
repository = "https://github.com/libp2p/rust-libp2p" | ||
|
@@ -18,7 +18,7 @@ asynchronous-codec = "0.6" | |
futures = "0.3.1" | ||
log = "0.4" | ||
libp2p-core = { version = "0.28.0", path = "../../core" } | ||
libp2p-swarm = { version = "0.28.0", path = "../../swarm" } | ||
libp2p-swarm = { version = "0.29.0", path = "../../swarm" } | ||
prost = "0.7" | ||
rand = "0.7.2" | ||
sha2 = "0.9.1" | ||
|
Oops, something went wrong.