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