-
Notifications
You must be signed in to change notification settings - Fork 213
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
refactor(iroh-docs): Replace flume with async_channel in docs #2540
Conversation
This is mostly a 1:1 replacement, except for the fact that the same_channel api is missing from async_channel. So I replaced it with some ugly code that uses the fact that a async_channel Sender or Receiver is just an Arc<Channel>. To be removed if/when smol-rs/async-channel#98 is merged, but until then I think it is fine.
b0082bc
to
a5720e9
Compare
pub fn doc_list( | ||
&self, | ||
_req: DocListRequest, | ||
) -> impl Stream<Item = RpcResult<DocListResponse>> + Unpin { |
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.
Added Unpin here. it was unpin before - implicitly assumed, but it is better to be explicit. Maybe we should remove this later, but for now let's keep it as close as possible to before. Otherwise I think this would be a breaking change.
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.
LGTM. Not sure about the same_channel unsafe, would have to read rust mem docs to validate first. But if you did this, fine to approve.
## Description This is mostly a 1:1 replacement, except for the fact that the same_channel api is missing from async_channel. So I replaced it with some ugly code that uses the fact that a async_channel Sender or Receiver is just an Arc<Channel>. To be removed if/when smol-rs/async-channel#98 is merged, but until then I think it is fine. ## Breaking Changes None ## Notes & open questions Note: we can not use tokio::sync::mpsc::Channel for the actor because we can't control from which thread Drop is called. Note: some streams were Unpin before, but it was not explicit. Now I added Unpin explicitly (and boxed the stream to make it true). Not sure if the version check would catch this, pretty sure that not. But taking away Unpin would have been a breaking change. ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
Description
This is mostly a 1:1 replacement, except for the fact that the same_channel api is missing from async_channel. So I replaced it with some ugly code that uses the fact that a async_channel Sender or Receiver is just an Arc.
To be removed if/when smol-rs/async-channel#98 is merged, but until then I think it is fine.
Breaking Changes
None
Notes & open questions
Note: we can not use tokio::sync::mpsc::Channel for the actor because we can't control from which thread Drop is called.
Note: some streams were Unpin before, but it was not explicit. Now I added Unpin explicitly (and boxed the stream to make it true). Not sure if the version check would catch this, pretty sure that not. But taking away Unpin would have been a breaking change.
Change checklist