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
Add Tokio support #27
Conversation
Pull Request Test Coverage Report for Build 231501058Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@afdw first I'd like to thank you for this great work. I think this goes in the right direction and solves the concerns we had regarding code duplication. There are a couple of things I'd like to ask if we could rework on this PR prior merging it. First is to spinoff the code which is independent and which we could merge right away. Here I am referring to the Next, I'd like to explore the possibility of making this independent of |
There is a couple of problems with that:
This is a good idea, I want it be independent of Tokio too, but at the current stage of the async infrastructure I don't think that's possible. Or do you have any ideas of how to solve the problems mentioned above? |
Sure and
For this, we can use blocking. What do you think? |
Thanks, I have not seen that. Yes, this is indeed possible.
That is one of the options. The problem is that a separate (from Tokio's one) thread pool will be used, which is may or may not be desirable. What do you think can be done with that? I think offering 2 modules ( |
What about offering a single This could basically use the runtime specific |
The problem with using a single module is that than it will not be possible to, for example, run |
Indeed. So, in that case, we need to decide. I'd be Ok in using What is your preference? |
I do not think that having 2 implementations is problematic, they are just very thin and simple wrappers. So I have implemented them. But reducing repetitiveness would be good. The problem is that they have many things in common, but have some subtle differences, so generating them with a macro is not that straightforward, but actually could still be done. |
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 think we need to document the features so people can make the right choices. Also, can you squash the commits and add the examples as later commits so we isolate the changes in logical units?
Also, please rebase the changes. |
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 would also like to change the flags and module names of tokio_support
and futures_support
to just tokio
and futures
, I think this would be just as much meaningful. As for the async_support
I'm fine with it since async
is a keyworld and can't be a module name.
The problem is that it is impossible to have a dependency and a feature with the same name. |
Yes and for this, we can map the package internally, so we can expose the feature name. |
I am not really sure that would be better. This maybe confusing, as someone may think this are reexports of Do you have any alternative ideas on how to make the module naming better? |
@afdw it is a fair justification. I was discussing with @Jonathas-Conceicao and we agreed it is a good way to go. Could you rebase the tree and prepare the commits for review/merging? |
OK, done? |
@afdw just made 0.7.0 release. Thanks for all your help :-) awesome! |
Similar to #24, but without duplicated functionality and more carefully thought out, although there might still be mistakes. This one does not change existing code at all, only adds new module named
tokio_support
. It works by calling functions from the root of the crate in thread where blocking is acceptable and communicates with this thread using channels, thus implementingRead
andWrite
in terms ofAsyncRead
andAsyncWrite
. This allows to use the library in applications that are based on Tokio, mainly in client/servers. A usage example namedasync_uncompress_service
is provided, along with it sync versionuncompress_service
for comparison.