wasmtime_wasi/cli/
mem.rs

1use crate::cli::{IsTerminal, StdinStream, StdoutStream};
2use crate::p2;
3use tokio::io::{AsyncRead, AsyncWrite};
4use wasmtime_wasi_io::streams::{InputStream, OutputStream};
5
6// Implementation for p2::pipe::MemoryInputPipe
7impl IsTerminal for p2::pipe::MemoryInputPipe {
8    fn is_terminal(&self) -> bool {
9        false
10    }
11}
12impl StdinStream for p2::pipe::MemoryInputPipe {
13    fn p2_stream(&self) -> Box<dyn InputStream> {
14        Box::new(self.clone())
15    }
16    fn async_stream(&self) -> Box<dyn AsyncRead + Send + Sync> {
17        Box::new(self.clone())
18    }
19}
20
21// Implementation for p2::pipe::MemoryOutputPipe
22impl IsTerminal for p2::pipe::MemoryOutputPipe {
23    fn is_terminal(&self) -> bool {
24        false
25    }
26}
27impl StdoutStream for p2::pipe::MemoryOutputPipe {
28    fn p2_stream(&self) -> Box<dyn OutputStream> {
29        Box::new(self.clone())
30    }
31    fn async_stream(&self) -> Box<dyn AsyncWrite + Send + Sync> {
32        Box::new(self.clone())
33    }
34}