Feature : recv
and send
methods for the request_reply sockets that takes a mutable reference of the RequestReceiver
and the RequestSender
#41
Labels
enhancement
New feature or request
I believe
recv(mut self)
andsend(mut self, mut msg: Multipart)
in the request_reply sockets were designed to take self instead of &mut self so you cannot make multiplesend
before getting the reply andrcv
before sending the reply.However in the case of
tokio::select!
inside of aloop
:because
recv()
consumes self, the compiler won't allow for it to be used in this case.A barbaric solution would be to spawn a task containing the
recv()
and use channels to communicate back and forth with theselect!
, however i'd rather have an appropriate method for this case.Without wanting to alter the current structure, a quick fix for me was the create a
struct RequestReply
contaning both thesend(&mut self, mut msg: Multipart)
and therecv(&mut self)
methods in the cloned repo.The text was updated successfully, but these errors were encountered: