Skip to content
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

Merged
merged 4 commits into from
Sep 7, 2021

Conversation

maan2003
Copy link
Collaborator

@maan2003 maan2003 commented Sep 5, 2021

Sometimes using commands to mutate data from ExtEventSink can be complicated and verbose.
This provides a simpler alternative.

Sometimes using commands to mutate data from ExtEventSink can be very verbose.
This provides a simpler alternative.
Copy link
Collaborator

@jneem jneem left a 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;
Copy link
Collaborator

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...

Copy link
Collaborator Author

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 🤷‍♂️

druid/src/ext_event.rs Show resolved Hide resolved
druid/src/ext_event.rs Outdated Show resolved Hide resolved
@jneem
Copy link
Collaborator

jneem commented Sep 5, 2021

Thanks! CI failure seems spurious...

@PoignardAzur PoignardAzur merged commit 7f4d0ce into linebender:master Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants