bjorn3 said:
You can use
.set_stdout
and pass a custom type implementingWasiFile
. In this implementation you can line buffer and then useinfo!()
when the line gets flushed.
https://docs.rs/wasmtime-wasi/0.28.0/wasmtime_wasi/trait.WasiFile.html has a lot of functions that I don't want to implement. Is there an example I could follow of what you're describing here?
You can look at the WasiFile impl for Stdout: https://docs.rs/wasmtime-wasi/0.28.0/wasmtime_wasi/sync/stdio/struct.Stdout.html Looks like there is also a WritePipe type that wraps any std::io::Write implementing type.
Last updated: Dec 23 2024 at 12:05 UTC