Closed w1nns closed 1 year ago
You can achieve this by using atomic types, concurrent data structures, or explicit locking using mutexes. Assuming you're only setting up one handler per call, mutexes will have practically no cost. The use of shared references is a 'training wheel' measure, since the API might move to spawned futures (all of which point to the same handler) down the line.
Hi! I'm trying to create a discord voice recorder based on this example . How can I create a buffer in which I will put voice packets in order to write it all to a file in the future? I added the buf field to the Receiver structure.
But I can't change buf field, because the reference to Receiver is not mutable in the act method. If I make this reference mutable, then there will be signature incompatibility.