core/muxing: Have functions on StreamMuxer take Pin<&mut Self>#2765
Merged
thomaseizinger merged 12 commits intomasterfrom Aug 3, 2022
Merged
core/muxing: Have functions on StreamMuxer take Pin<&mut Self>#2765thomaseizinger merged 12 commits intomasterfrom
StreamMuxer take Pin<&mut Self>#2765thomaseizinger merged 12 commits intomasterfrom
Conversation
This is the idiomatic way of defining `poll`-based interfaces in Rust despite introducing a bit of inconvenience. To work around this inconvenience, we also introduce a `StreamMuxerExt` trait allows for better integration with async-await style code and adds a `_unpin` variant to for each `poll` function of the `StreamMuxer`.
Now that the `StreamMuxer` interface has `Pin<&mut Self>` receivers, we can drop the `Mutex` from the yamux implementation.
StreamMuxer take Pin<&mut Self>
elenaf9
reviewed
Jul 23, 2022
Co-authored-by: Elena Frank <[email protected]>
The muxer is useless after polling `poll_close` to completion, thus we can consume `self` in the extension trait method which allows us to use the function within `libp2p_swarm::Connection`.
This was referenced Jul 25, 2022
mxinden
reviewed
Jul 25, 2022
Member
mxinden
left a comment
There was a problem hiding this comment.
🙏 thanks for the patch using Pin.
Contributor
Author
thomaseizinger
commented
Aug 1, 2022
mxinden
approved these changes
Aug 3, 2022
Member
mxinden
left a comment
There was a problem hiding this comment.
Wonderful to see this happening! 🙏
Member
|
@elenaf9 any objections to me merging here with the discussion on #2722 (comment) in mind? I think we want to take |
elenaf9
reviewed
Aug 3, 2022
elenaf9
approved these changes
Aug 3, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is the idiomatic way of doing
pollinterface in Rust.Links to any relevant issues
#2722
Depends on #2763.
Depends on #2764.
Depends on #2775.
Depends on #2776.
Open Questions
Change checklist