-
Notifications
You must be signed in to change notification settings - Fork 962
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
core/: Remove TInEvent and TOutEvent #2183
Conversation
- Removes the `Swarm` type alias, renaming `ExpandedSwarm` to `Swarm`. - Remove `TInEvent`, `TOutEvent` and `THandler` trait parameters on `Swarm`, instead deriving them through `TBehaviour`. Move derive logic to separate type aliases. - Simplify trait bounds on `Swarm` main `impl` and `Stream` `impl`.
TInEvent and TOutEvent are implied through THandler and thus superflucious. Both are removed in favor of a derivation through THandler.
@thomaseizinger given your review on #2182, could you take a look at this patch as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
I like the reduction in type parameters, should make it easier to iterate on libp2p-core. Nice work!
protocols/relay/CHANGELOG.md
Outdated
@@ -2,6 +2,10 @@ | |||
|
|||
- Update dependencies. | |||
|
|||
- Implement `Debug` for `RelayHandlerEvent` and `RealyHandlerIn`. See [PR 2183]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo RealyHandlerIn
.
- Implement `Debug` for `RelayHandlerEvent` and `RealyHandlerIn`. See [PR 2183]. | |
- Implement `Debug` for `RelayHandlerEvent` and `RelayHandlerIn`. See [PR 2183]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fixed in 6435bd7.
@@ -2,6 +2,10 @@ | |||
|
|||
- Update dependencies. | |||
|
|||
- Implement `Debug` for `RequestResponseCodec` and `RequestProtocol`. See [PR 2183]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that accurate? The Debug impl of RequestProtocol
already existed, just now it is hand-rolled.
And I can't see a Debug impl for RequestResponseCodec
itself.
Is this a leftover from an earlier iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Addressed in d78576c.
swarm/src/protocols_handler.rs
Outdated
@@ -101,11 +101,11 @@ pub use select::{IntoProtocolsHandlerSelect, ProtocolsHandlerSelect}; | |||
/// continue reading data until the remote closes its side of the connection. | |||
pub trait ProtocolsHandler: Send + 'static { | |||
/// Custom event that can be received from the outside. | |||
type InEvent: Send + 'static; | |||
type InEvent: Debug + Send + 'static; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you would reference these as fmt::Debug
, the imports would be slightly cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine either way. Applied suggestion in 4576356.
TInEvent and TOutEvent are implied through THandler and thus
superflucious. Both are removed in favor of a derivation through
THandler.