https://github.com/parasyte/egui-tokio-example
Example showing how to use tokio and egui together.
https://github.com/parasyte/egui-tokio-example
egui rust tokio
Last synced: 7 months ago
JSON representation
Example showing how to use tokio and egui together.
- Host: GitHub
- URL: https://github.com/parasyte/egui-tokio-example
- Owner: parasyte
- Created: 2022-08-24T05:41:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-24T06:05:57.000Z (about 3 years ago)
- Last Synced: 2025-03-18T06:22:45.622Z (7 months ago)
- Topics: egui, rust, tokio
- Language: Rust
- Homepage: https://github.com/emilk/egui/discussions/521
- Size: 16.6 KB
- Stars: 46
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example using `tokio` with `egui`
This example uses `reqwest` to send an HTTP request to [httpbin](https://httpbin.org/). The parsed response contains an increment value (as provided in the request) that is finally sent to the main GUI thread.
## Disclaimer
This is the worst possible way to increment a counter, but it demonstrates awaiting async tasks without blocking the main GUI thread. It is also a very poor use of `tokio`. Awaiting the future in a thread with `pollster` is both easier and just as efficient. But if you _actually_ need `tokio`, this is how to use it with `egui`.