fix tests in pipe

This commit is contained in:
Pat Hickey
2021-01-14 14:14:41 -08:00
parent 5c8efe868e
commit 4b39a14163

View File

@@ -23,9 +23,8 @@ use system_interface::fs::{Advice, FileIoExt};
/// ``` /// ```
/// # use wasi_c2::WasiCtx; /// # use wasi_c2::WasiCtx;
/// # use wasi_c2::virt::pipe::ReadPipe; /// # use wasi_c2::virt::pipe::ReadPipe;
/// let mut ctx = WasiCtx::builder();
/// let stdin = ReadPipe::from("hello from stdin!"); /// let stdin = ReadPipe::from("hello from stdin!");
/// ctx.stdin(Box::new(stdin)); /// let ctx = WasiCtx::builder().stdin(Box::new(stdin)).build();
/// ``` /// ```
#[derive(Debug)] #[derive(Debug)]
pub struct ReadPipe<R: Read> { pub struct ReadPipe<R: Read> {
@@ -209,9 +208,8 @@ impl<R: Read + Any> WasiFile for ReadPipe<R> {
/// ``` /// ```
/// # use wasi_c2::WasiCtx; /// # use wasi_c2::WasiCtx;
/// # use wasi_c2::virt::pipe::WritePipe; /// # use wasi_c2::virt::pipe::WritePipe;
/// let mut ctx = WasiCtx::builder();
/// let stdout = WritePipe::new_in_memory(); /// let stdout = WritePipe::new_in_memory();
/// ctx.stdout(Box::new(stdout.clone())); /// let ctx = WasiCtx::builder().stdout(Box::new(stdout.clone())).build();
/// // use ctx in an instance, then make sure it is dropped: /// // use ctx in an instance, then make sure it is dropped:
/// drop(ctx); /// drop(ctx);
/// let contents: Vec<u8> = stdout.try_into_inner().expect("sole remaining reference to WritePipe").into_inner(); /// let contents: Vec<u8> = stdout.try_into_inner().expect("sole remaining reference to WritePipe").into_inner();