Skip to content

Conversation

@tronta
Copy link
Contributor

@tronta tronta commented Jan 5, 2023

Some further suggestions when reading through the book.

@tronta tronta requested a review from AaronErhardt January 5, 2023 21:42
Copy link
Member

@AaronErhardt AaronErhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

This works because GTK uses an event loop from GLib to handle asynchronous events, which also allows you to execute futures.

The only drawback of this solution is that not all async libraries are fully compatible with the GLib executor, since they must use Tokyo.
A drawback of this solution is that you only can use libraries which support Tokio, as the GLib executor depends on it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, Glib doesn't depend on tokio, but many async crates do. For example, using reqwest in future on a GLib executor will panic because it needs some tokio-specific features. This is not obvious for beginners because it should be as simple as using async/await but sadly that's not true in reality.

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