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

swarm/src/either: implement NetworkBehaviour on Either #2370

Merged
merged 8 commits into from
Dec 12, 2021

Conversation

mexskican
Copy link
Contributor

@mexskican mexskican commented Dec 8, 2021

Closes #2353

Implement NetworkBehaviour on either::Either<L, R> where both L
and R implement NetworkBehaviour.

Add NetworkBehaviour derive tests for Either and Toggle

Implement `NetworkBehaviour` on `either::Either<L, R>` where both L
and R both implement `NetworkBehaviour`.

Add NetworkBehaviour derive tests for Either and Toggle
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mexskican for picking this up!

Looks good to me, just a couple of smaller comments. Great job getting familiar with these somewhat complicated internals!

While reviewing I had the idea described in #2374. I would be interested in your opinion @mexskican.

swarm/src/behaviour.rs Outdated Show resolved Hide resolved
swarm/src/either.rs Outdated Show resolved Hide resolved
swarm/src/either.rs Outdated Show resolved Hide resolved
swarm-derive/tests/test.rs Outdated Show resolved Hide resolved
swarm-derive/tests/test.rs Show resolved Hide resolved
swarm/src/behaviour.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines 43 to 46
match self {
Either::Left(a) => IntoEitherHandler::Left(a.new_handler()),
Either::Right(b) => IntoEitherHandler::Right(b.new_handler()),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a pity rayon-rs/either#58 is not merged / released yet ...

swarm-derive/tests/test.rs Outdated Show resolved Hide resolved
@mexskican mexskican requested a review from mxinden December 10, 2021 01:49
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. THanks @mexskican for the follow-ups!

swarm/src/behaviour.rs Outdated Show resolved Hide resolved
@mxinden mxinden merged commit ab7b5a4 into libp2p:master Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deriving NetworkBehaviour for Enums.
3 participants