I'm trying to build my first Rust project and got stuck with this issue.
Basically I have a singleton server instance (implemented as a struct) which has unique access to some external IO device. There are multiple clients in different threads submitting request to the IO device (through the server) and waiting for responses.
Ideally I see this as the server having a single queue where clients would use and server taking requests from the queue one-by-one and executing them. Clients upon submitting a request would get back a Future which resolves once there's a response.
server struct is not thread safe so I can't just pass it around in a mutex and this is where my knowledge of Rust ecosystem/idioms ends. I'd really appreciate any hints/links/examples of how something like the above can be implemented.