cetra3 / tmq

Rust ZeroMQ bindings for Tokio
150 stars 28 forks source link

added struct RequestReply #42

Open eldoccc opened 1 year ago

eldoccc commented 1 year ago

allows send() and recv() to be cancel safe : they both take mutable references to the struct

in the case of recv() being used inside a tokio::select! for example

It should probably be specified that this isn't as safe as the RequestSender / RequestReceiver way as you could try to send a multipart before receiving data in the case of the receiver and vice versa.

cetra3 commented 1 year ago

I think because this is not as safe maybe we should investigate another way to do this. I don't want to introduce a footgun here if there is a cleaner way to do it.