mirror of
https://github.com/fluencelabs/marine.git
synced 2025-03-15 22:10:49 +00:00
add a non-default constructor of WasmBackend
This commit is contained in:
parent
17ca1030a1
commit
81f896f2cf
@ -49,7 +49,7 @@ pub struct MarineCore<WB: WasmBackend> {
|
||||
|
||||
impl<WB: WasmBackend> MarineCore<WB> {
|
||||
pub fn new() -> Self {
|
||||
let wasm_backend = WB::default();
|
||||
let wasm_backend = WB::new();
|
||||
let store = <WB as WasmBackend>::Store::new(&wasm_backend);
|
||||
Self {
|
||||
modules: HashMap::new(),
|
||||
|
@ -91,6 +91,17 @@ impl WasmBackend for WasmtimeWasmBackend {
|
||||
inner: module,
|
||||
})
|
||||
}
|
||||
|
||||
fn new() -> Self {
|
||||
let mut config = wasmtime::Config::new();
|
||||
config
|
||||
.debug_info(true)
|
||||
.wasm_backtrace_details(wasmtime::WasmBacktraceDetails::Enable);
|
||||
let engine = wasmtime::Engine::new(&config).unwrap();
|
||||
Self {
|
||||
engine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -57,6 +57,8 @@ pub trait WasmBackend: Clone + Default + 'static {
|
||||
type Wasi: WasiImplementation<Self>;
|
||||
|
||||
fn compile(store: &mut Self::Store, wasm: &[u8]) -> CompilationResult<Self::Module>;
|
||||
|
||||
fn new() -> Self;
|
||||
}
|
||||
|
||||
pub struct DelayedContextLifetime<WB: WasmBackend> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user