but i have a bigger problem, if i have a reference to the client, i cant use that to spawn a task (apparently?) i could take an Arc<Client> but in the real world users will have an Arc<Context> which wraps over that client so yeah idk what to do now
so what do you think is a better approach for this? thank you :)
You will need to have the Arc<Client> - there's not really any other option. tokio::spawn() returns a task, which (like a thread) could potentially run forever, so there's no way you can pass a reference to a task.
Could you have an Arc<Context> that contains an Arc<Client>, and then pass a clone() of the Arc<Client> to the task?
thank you! the best choice seems like changing the parameter to client: Arc<Client> then, and in reality client is in a Bot { client: Client } so i should make that Bot { client: Arc<Client> }, is it a good design to nest Arcs by the way?