veeso / tui-realm

👑 tui-rs framework to build stateful applications with a React/Elm inspired approach

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Async Support

andyslucky opened this issue · comments

Hey, I am currently working on a tui application that connects to a database using the sqlx crate. These operations are async and I currently use the tokio crate as an async runtime. I would love to simplify alot of the components in my project using this crate, however I cannot give up my async operations. Is there a roadmap/ expectation that async will be supported in the future? I suppose the only function that would need to be async is the update fn in the Update trait, but there may be other useful candidates.

Hi,

no, there's no plan to make this library async, for the basic reason that it doesn't rely on any async crate: tui-rs doesn't support async and the same is for the terminal backends, such as termion and crossterm.

Anyway, you should always be able to use sync code from async program, as far as I know.

You can put tokio on another thread and use std::sync::mpsc to communicate between the TUI thread and the sqlx thread.