Remove need for HostRef<Engine> (#762)
This commit removes the need to use `HostRef<Engine>` in the Rust API. Usage is retained in the C API in one location, but otherwise `Engine` can always be used directly. This is the first step of progress on #708 for the `Engine` type. Changes here include: * `Engine` is now `Clone`, and is documented as being cheap. It's not intended that cloning an engine creates a deep copy. * `Engine` is now both `Send` and `Sync`, and asserted to be so. * Usage of `Engine` in APIs no longer requires or uses `HostRef`.
This commit is contained in:
@@ -38,7 +38,7 @@ fn main() -> Result<()> {
|
||||
let wasm = wat::parse_str(WAT)?;
|
||||
|
||||
// Instantiate engine and store.
|
||||
let engine = HostRef::new(Engine::default());
|
||||
let engine = Engine::default();
|
||||
let store = HostRef::new(Store::new(&engine));
|
||||
|
||||
// Load a module.
|
||||
|
||||
@@ -18,7 +18,7 @@ fn main() -> Result<()> {
|
||||
// Configure the initial compilation environment, creating more global
|
||||
// structures such as an `Engine` and a `Store`.
|
||||
println!("Initializing...");
|
||||
let engine = HostRef::new(Engine::default());
|
||||
let engine = Engine::default();
|
||||
let store = HostRef::new(Store::new(&engine));
|
||||
|
||||
// Next upload the `*.wasm` binary file, which in this case we're going to
|
||||
|
||||
@@ -62,7 +62,7 @@ macro_rules! call {
|
||||
fn main() -> Result<(), Error> {
|
||||
// Initialize.
|
||||
println!("Initializing...");
|
||||
let engine = HostRef::new(Engine::default());
|
||||
let engine = Engine::default();
|
||||
let store = HostRef::new(Store::new(&engine));
|
||||
|
||||
// Load binary.
|
||||
|
||||
@@ -50,7 +50,7 @@ fn main() -> Result<()> {
|
||||
multi_value: true,
|
||||
..Default::default()
|
||||
});
|
||||
let engine = HostRef::new(Engine::new(&cfg));
|
||||
let engine = Engine::new(&cfg);
|
||||
let store = HostRef::new(Store::new(&engine));
|
||||
|
||||
// Load binary.
|
||||
|
||||
Reference in New Issue
Block a user