Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi/src/cli/mem.rs
1693 views
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 {
8
fn is_terminal(&self) -> bool {
9
false
10
}
11
}
12
impl 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
22
impl IsTerminal for p2::pipe::MemoryOutputPipe {
23
fn is_terminal(&self) -> bool {
24
false
25
}
26
}
27
impl 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
}
35
36