Thanks to visit codestin.com
Credit goes to lib.rs

#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

#1868 in Asynchronous

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

1,163 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

~45–90MB
~1.5M SLoC