wasmer
wasmer copied to clipboard
wasmer::EngineBuilder::engine returns a wasmer_compiler::Engine instead of wasmer::Engine
I've been trying to upgrade wasmer, but have been unable to because 3.x is very slow dropping instances of modules. In order to do this fast, I apparently need to share an engine across all the instances (https://github.com/wasmerio/wasmer/pull/3378#issuecomment-1327679422).
I just tried out wasmer 3.3 and was unable to upgrade because wasmer::EngineBuilder::engine returns a wasmer_compiler::Engine instead of wasmer::Engine and is therefore incompatible with EngineRef. For example, the following code does not work:
let compiler = Cranelift::default();
let engine = EngineBuilder::new(compiler).engine();
let engineref = EngineRef::new(&engine);
// ^^^^^^^ expected struct `Engine`, found struct `wasmer_compiler::engine::inner::Engine`
let module = Module::new(&engineref, &wasm_bytes)?;
I've discovered a way to do this is to do:
let engine: wasmer::Engine = engine.into();
let engine_ref = EngineRef::new(&engine);
That said, this is not very discoverable. I feel like .engine() in EngineBuilder should still return a wasmer::Engine?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Feel free to reopen the issue if it has been closed by mistake.