Implement RFC 11: Redesigning Wasmtime's APIs (#2897)

Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it's best to read the RFC thread and the PR thread.
This commit is contained in:
Alex Crichton
2021-06-03 09:10:53 -05:00
committed by GitHub
parent a5a28b1c5b
commit 7a1b7cdf92
233 changed files with 13349 additions and 11997 deletions

View File

@@ -42,9 +42,7 @@ pub use clocks::clocks_ctx;
pub use sched::sched_ctx;
use cap_rand::RngCore;
use std::cell::RefCell;
use std::path::Path;
use std::rc::Rc;
use wasi_common::{table::Table, Error, WasiCtx, WasiFile};
pub struct WasiCtxBuilder(WasiCtx);
@@ -55,7 +53,7 @@ impl WasiCtxBuilder {
random_ctx(),
clocks_ctx(),
sched_ctx(),
Rc::new(RefCell::new(Table::new())),
Table::new(),
))
}
pub fn env(mut self, var: &str, value: &str) -> Result<Self, wasi_common::StringArrayError> {
@@ -124,6 +122,6 @@ impl WasiCtxBuilder {
}
}
pub fn random_ctx() -> RefCell<Box<dyn RngCore>> {
RefCell::new(Box::new(unsafe { cap_rand::rngs::OsRng::default() }))
pub fn random_ctx() -> Box<dyn RngCore + Send + Sync> {
Box::new(unsafe { cap_rand::rngs::OsRng::default() })
}