diff --git a/crates/wasi-common/src/lib.rs b/crates/wasi-common/src/lib.rs index 5dc7c90913..2d0f50a5f4 100644 --- a/crates/wasi-common/src/lib.rs +++ b/crates/wasi-common/src/lib.rs @@ -10,9 +10,12 @@ pub mod snapshots; mod string_array; pub mod table; -pub use clocks::SystemTimeSpec; +pub use cap_rand::RngCore; +pub use clocks::{SystemTimeSpec, WasiClocks, WasiMonotonicClock, WasiSystemClock}; pub use ctx::{WasiCtx, WasiCtxBuilder}; -pub use dir::{DirCaps, ReaddirCursor, ReaddirEntity, WasiDir}; +pub use dir::WasiDir; pub use error::{Error, ErrorExt, ErrorKind}; -pub use file::{FdFlags, FileCaps, Filestat, OFlags, WasiFile}; +pub use file::WasiFile; +pub use sched::{Poll, WasiSched}; pub use string_array::StringArrayError; +pub use table::Table; diff --git a/crates/wasi-common/src/pipe.rs b/crates/wasi-common/src/pipe.rs index 71e4130932..8bbc8d73b7 100644 --- a/crates/wasi-common/src/pipe.rs +++ b/crates/wasi-common/src/pipe.rs @@ -22,11 +22,19 @@ use std::sync::{Arc, RwLock}; /// /// A variety of `From` impls are provided so that common pipe types are easy to create. For example: /// -/// ``` -/// # use wasi_c2::WasiCtx; -/// # use wasi_c2::virt::pipe::ReadPipe; +/// ```no_run +/// # use std::rc::Rc; +/// # use std::cell::RefCell; +/// use wasi_common::{pipe::ReadPipe, WasiCtx, Table}; /// let stdin = ReadPipe::from("hello from stdin!"); -/// let ctx = WasiCtx::builder().stdin(Box::new(stdin)).build(); +/// // Brint these instances from elsewhere (e.g. wasi-cap-std-sync): +/// let random = todo!(); +/// let clocks = todo!(); +/// let sched = todo!(); +/// let table = Rc::new(RefCell::new(Table::new())); +/// let ctx = WasiCtx::builder(random, clocks, sched, table) +/// .stdin(Box::new(stdin.clone())) +/// .build(); /// ``` #[derive(Debug)] pub struct ReadPipe { @@ -170,11 +178,19 @@ impl WasiFile for ReadPipe { /// A virtual pipe write end. /// -/// ``` -/// # use wasi_c2::WasiCtx; -/// # use wasi_c2::virt::pipe::WritePipe; +/// ```no_run +/// # use std::rc::Rc; +/// # use std::cell::RefCell; +/// use wasi_common::{pipe::WritePipe, WasiCtx, Table}; /// let stdout = WritePipe::new_in_memory(); -/// let ctx = WasiCtx::builder().stdout(Box::new(stdout.clone())).build(); +/// // Brint these instances from elsewhere (e.g. wasi-cap-std-sync): +/// let random = todo!(); +/// let clocks = todo!(); +/// let sched = todo!(); +/// let table = Rc::new(RefCell::new(Table::new())); +/// let ctx = WasiCtx::builder(random, clocks, sched, table) +/// .stdout(Box::new(stdout.clone())) +/// .build(); /// // use ctx in an instance, then make sure it is dropped: /// drop(ctx); /// let contents: Vec = stdout.try_into_inner().expect("sole remaining reference to WritePipe").into_inner();