You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the relay portion of this a library, where you can register callback handlers for incoming data. This is totally unnecessary for the app I'm building, but I think it would have a few benefits for learning rust, namely
How to build and use a library.
Dealing with threading so users can send messages independently of recving them
The text was updated successfully, but these errors were encountered:
Need a way to register callback functions. Without knowing anything about how rust could acomplish this, my first thought is storing functions in a key/value mapping. Every function will need to have a signature like:
The hdata is obvious, that is the contents of the message. The generic box pointer then is less so. If they have a callback method, they may need some additional state to handle it. In the case of playing a sound on highlight, I wouldn't need it, so Option would be None. But if they were wanting to keep track of, say, who you have unread messages from, or really anything more complex then playing a sound, they will probably need some external state. Passing it back to the function call seems better then making them use a global somewhere. Although, maybe there is a better way to do all this, I'm just thinking here. Maybe something with traits could help? Dunno.
Make the relay portion of this a library, where you can register callback handlers for incoming data. This is totally unnecessary for the app I'm building, but I think it would have a few benefits for learning rust, namely
The text was updated successfully, but these errors were encountered: