erickt / rust-zmq

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

responder.recv(&mut msg, 0).unwrap(); ERROR: expected struct `zmq::Message`, found enum `std::result::Result` #225

Closed manhnt9 closed 5 years ago

manhnt9 commented 5 years ago

I'm trying example hello world server and get this compile error:

 --> src/main.rs:64:24
   |
64 |         responder.recv(&mut msg, 0).unwrap();
   |                        ^^^^^^^^ expected struct `zmq::Message`, found enum `std::result::Result`
   |
   = note: expected type `&mut zmq::Message`
              found type `&mut std::result::Result<zmq::Message, zmq::Error>`
manhnt9 commented 5 years ago

change

let mut msg = zmq::Message::new();

to

let mut msg = zmq::Message::new().unwrap();

fixes the error

erickt commented 5 years ago

Thanks! This has been fixed in the almost released 0.9.0.

9kunal commented 5 years ago

Hi erickt, It seems like for the helloWorld_server and client files are not updated to what you said above.

Its still let mut msg = zmq::Message::new();

https://github.com/erickt/rust-zmq/blob/master/examples/zguide/helloworld_server/main.rs#L18

Can you please fix this. Thanks!