erickt / rust-zmq

Rust zeromq bindings.
Apache License 2.0
886 stars 189 forks source link

implement AsRawFd #306

Closed yihuang closed 3 years ago

yihuang commented 4 years ago

Fix #305

peterjoel commented 4 years ago

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

yihuang commented 4 years ago

@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:

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.

kalcutter commented 3 years ago

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

yihuang commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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