-
-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to async traits for handling event callbacks #522
Comments
As I've been working on this, I realized that the each fn in the trait has to return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the stabilization of async fn in trait as of 1.75, I think it would be more ergonomic to have a single state to handle all events which implements a trait rather than having to register each callback individually, and would also reduce heap allocation. Default implementations for the trait can also allow the same functionality as before, as they all return
impl Future<Output = ()>
.Below is a basic example of what I'm suggesting (keep in mind I have not tested any of the code below):
changing the implementation to something like:
and would change the play-from-disk-h264 example to something like:
I'll follow this up with a pr, but with the scope of how much needs to be changed it might take awhile. Also, as it is a very new feature, I wanted to see if there would be any discussion.
The text was updated successfully, but these errors were encountered: