I am writing a Modus-TCP server as my initiation into this. Modes is a very simple protocol: you have a block of 64*1024 16 bit numbers. You write to them. You read them. End of story.
So far my server does all the read operations. Now when it came to doing the writes, I got caught in a bind. The Service trait (that is, the struct that has it) is the top level of the Tokio protocol stay… And the call() function in that trait has a non-mutable reference to self.
Which means if I put a mutable member in the struct, I don’t get to write to it in call().
So should I spawn a thread, with two channels, and have the Service::call() method pass in the request into one channel, get the response from the other, and let that thread do the gets and sets?