mirror of
https://github.com/fluencelabs/marine.git
synced 2025-03-31 05:01:06 +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> {
|
impl<WB: WasmBackend> MarineCore<WB> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let wasm_backend = WB::default();
|
let wasm_backend = WB::new();
|
||||||
let store = <WB as WasmBackend>::Store::new(&wasm_backend);
|
let store = <WB as WasmBackend>::Store::new(&wasm_backend);
|
||||||
Self {
|
Self {
|
||||||
modules: HashMap::new(),
|
modules: HashMap::new(),
|
||||||
|
@ -91,6 +91,17 @@ impl WasmBackend for WasmtimeWasmBackend {
|
|||||||
inner: module,
|
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)]
|
#[derive(Default)]
|
||||||
|
@ -57,6 +57,8 @@ pub trait WasmBackend: Clone + Default + 'static {
|
|||||||
type Wasi: WasiImplementation<Self>;
|
type Wasi: WasiImplementation<Self>;
|
||||||
|
|
||||||
fn compile(store: &mut Self::Store, wasm: &[u8]) -> CompilationResult<Self::Module>;
|
fn compile(store: &mut Self::Store, wasm: &[u8]) -> CompilationResult<Self::Module>;
|
||||||
|
|
||||||
|
fn new() -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DelayedContextLifetime<WB: WasmBackend> {
|
pub struct DelayedContextLifetime<WB: WasmBackend> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user