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

implement AsRawFd #306

Merged
merged 1 commit into from
Jul 30, 2020
Merged

implement AsRawFd #306

merged 1 commit into from
Jul 30, 2020

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented May 22, 2020

Fix #305

@yihuang yihuang force-pushed the async_smol branch 3 times, most recently from 05a291a to 2bf3b96 Compare May 22, 2020 18:58
@peterjoel
Copy link

@yihuang You might also be interested contributing to https://github.com/wusyong/async-zmq
It is based on this crate as dependency.

@yihuang
Copy link
Contributor Author

yihuang commented Jun 14, 2020

@yihuang You might also be interested contributing to https://github.com/wusyong/async-zmq
It is based on this crate as dependency.

That library don't look optimal for me:

  • much more code than the async example I provided
  • spawn it's own reactor thread, rather than allow user to provide reactor/runtime.
  • don't work on windows because of mio::EventedFd

I also used this PR of rust-zmq in the example of tokio-async-io.

If you are worried about the correctness of the async example, maybe you can merge the harmless AsRawFd/AsRawSocket trait impls only, which will enable other people to play with different async libraries.

Of course, the approach to async in this example is ad-hoc, but people can build on top of this concept into something more complete.

@yihuang yihuang changed the title implemente AsRawFd and an async example implement AsRawFd and an async example Jun 14, 2020
@kalcutter
Copy link
Contributor

Can you separate the AsRawFd impls and example into separate PRs? I imagine there would be no issue getting the AsRawFd change merged.

@yihuang yihuang changed the title implement AsRawFd and an async example implement AsRawFd Jul 12, 2020
@yihuang
Copy link
Contributor Author

yihuang commented Jul 12, 2020

Can you separate the AsRawFd impls and example into separate PRs? I imagine there would be no issue getting the AsRawFd change merged.

Done, removed the example from this PR, add made another one.

@erickt erickt merged commit d5ada96 into erickt:master Jul 30, 2020
@erickt
Copy link
Owner

erickt commented Jul 30, 2020

thanks! I'm not crazy about the unwraps here, but there's not much we can do if AsRawFd() doesn't let us return a Result.

@kalcutter
Copy link
Contributor

Another possibility is to return -1 for the fd. Maybe there is already a precedence for this?

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.

Implement AsRawFd/AsRawSocket for Socket
4 participants