I'm working on a project with two parts : a server that listen to a socket for client to register and hold the list of the client, and a second part that use the client list from the server part.
I want the second part to wait until at least one client is registered, but I want to avoid active waiting like this:
while server.client_count() == 0 {}
// do stuff
Is it possible to make a future that resolve as soon as a client is registered ?
Like this:
server.wait_for_client().await // wait until at least one client is registered
// do stuff