erickt / rust-zmq

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

PollItem: Support checking associated socket #292

Closed fwalch closed 4 years ago

fwalch commented 4 years ago

Adds is_socket and is_fd to PollItem to allow checking which socket a PollItem has been created from.

Enables some use cases related to #68.

fwalch commented 4 years ago

Thanks for the comment, fixed the issue and added an assertion to the tests.

I'm not completely happy with the function names, as they are very similar to the revents checks (e.g. is_readable). I kept them because they were the shortest ones I could come up with. If you have any suggestions, I'd be happy to change them.

rotty commented 4 years ago

Thanks for updating! I agree naming these is_ is suboptimal, a it's commonly used for predicates, which take no arguments. What about has_fd and has_socket?

fwalch commented 4 years ago

What about has_fd and has_socket?

Renamed the functions.

rotty commented 4 years ago

Thanks!