erickt / rust-zmq

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

Monitor socket event types #325

Closed yan-zaretskiy closed 3 years ago

yan-zaretskiy commented 3 years ago

Hi there. It looks like the

Socket::monitor(&self, monitor_endpoint: &str, events: i32) -> Result<()>

API may not be correct. It accepts a plain i32 value for the event type, but then there is the

pub enum SocketEvent

enum, which is what, I think, should be the actual input argument to the monitor. That enum has the to_raw() method, which produces an u16 value. So the resulting call I'm using looks like:

socket.monitor(
        "inproc://monitor-client",
        zmq::SocketEvent::DISCONNECTED.to_raw() as i32,
    )?;

which is IMHO not great...