#async-task #gpui #tokio #running #bridge

gpui-tokio-bridge

Tokio bridge for GPUI - allows running tokio async tasks within GPUI context

1 unstable release

Uses new Rust 2024

0.1.0 Jan 18, 2026

#81 in #gpui

Download history 53/week @ 2026-01-15 15/week @ 2026-01-29

68 downloads per month

Apache-2.0

52KB
56 lines

gpui-tokio-bridge

Tokio bridge for GPUI - allows running tokio async tasks within GPUI context.

Usage

use gpui_tokio_bridge::{init, Tokio};

// Initialize in your app setup
fn main() {
    gpui::Application::new().run(|cx| {
        init(cx);
        // ...
    });
}

// Spawn tokio tasks from GPUI context
impl MyComponent {
    fn fetch_data(&mut self, cx: &mut Context<Self>) {
        Tokio::spawn(cx, async {
            // Your async code here
            reqwest::get("https://api.example.com").await
        })
        .detach();
    }
}

Credits

Based on gpui_tokio from Zed Industries.

License

Apache-2.0

Dependencies

~47–91MB
~1.5M SLoC