tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.26k stars 2.41k forks source link

Support wasi-cli (stdin, stdout) #6501

Open Timmmm opened 4 months ago

Timmmm commented 4 months ago

Currently you can't use Tokio's stdin/stdout support (the io-std feature flag) on WASI. But WASI does support that in wasi-cli. I believe it is supported by Node now.

This would be immensely useful for distributing Rust LSP servers as WASI modules, so I don't have to cross compile for at least 4 targets. The best Rust LSP crate I've found is tower-lsp which uses Tokio, but the easiest way to communicate with the language server client (i.e. VSCode) is over stdin/stdout.

See also #4827

banocean commented 1 month ago

I believe it's case with all (or most) apis that requires syscalls. Since WASI 0.2 was stabilized the only thing holding this up is ability to access it in rust.

It's still possible to use api bindings not build into std lib, but it would require a lot of work that would be useless after it's implemented into std lib.

Creating issues for nearly every feature flag is kinda making a bigger mess when it's all based on the fact can it work with same apis as other targets.