-
Notifications
You must be signed in to change notification settings - Fork 569
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
ExtEventSink::add_idle_callback #1955
Conversation
Sometimes using commands to mutate data from ExtEventSink can be very verbose. This provides a simpler alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a very sensible API to me.
let color_clone = color.clone(); | ||
// schedule idle callback to change the data | ||
event_sink.add_idle_callback(move |data: &mut Color| { | ||
*data = color_clone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is totally the right way to do this, but maybe the previous code had some pedagogical value? Sometimes you really do want to send a command instead of mutate the data...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel blocking_function example is sufficient for that 🤷♂️
Thanks! CI failure seems spurious... |
Sometimes using commands to mutate data from ExtEventSink can be complicated and verbose.
This provides a simpler alternative.