mutable borrow of TcpStream inside select! #3740
-
Hi,
The problem is that I can't borrow EDIT: Please have you an idea how can I solve this problem ? I need your help ;) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
OK, I solved this problem by splitting the
That way, I have a mutable reference to |
Beta Was this translation helpful? Give feedback.
OK, I solved this problem by splitting the
stream
in two parts: areader
and awriter
. Then, I edited thereceive()
function to take ownership of the reader and return it at the end, alongside the buffer.receive_operation
is now declared like that:That way, I have a mutable reference to
writer
everywhere in the loop and ownership ofreader
in the firstselect!
branch so I can callreceive_operation.set(receive(reader))
.