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:
Alex Crichton
2020-01-06 15:17:03 -06:00
committed by GitHub
parent ad7d48479e
commit b9dc38f4e1
18 changed files with 56 additions and 28 deletions

View File

@@ -266,7 +266,7 @@ fn main() -> Result<()> {
.flags(settings::Flags::new(flag_builder))
.debug_info(debug_info)
.strategy(strategy);
let engine = HostRef::new(Engine::new(&config));
let engine = Engine::new(&config);
let store = HostRef::new(Store::new(&engine));
let mut module_registry = HashMap::new();

View File

@@ -154,7 +154,7 @@ fn main() {
cfg.strategy(strategy)
.flags(settings::Flags::new(flag_builder))
.features(features);
let store = HostRef::new(Store::new(&HostRef::new(Engine::new(&cfg))));
let store = HostRef::new(Store::new(&Engine::new(&cfg)));
let mut wast_context = WastContext::new(store);
wast_context