marine_js_backend/
lib.rs

1/*
2 * Copyright 2022 Fluence Labs Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17mod store;
18mod module;
19mod imports;
20mod instance;
21mod caller;
22mod function;
23mod memory;
24mod wasi;
25mod module_info;
26mod js_conversions;
27
28mod single_shot_async_executor;
29
30use crate::store::JsContextMut;
31use crate::store::JsStore;
32use crate::module::JsModule;
33use crate::store::JsContext;
34use crate::imports::JsImports;
35use crate::instance::JsInstance;
36use crate::memory::JsMemory;
37use crate::wasi::JsWasi;
38use crate::caller::JsImportCallContext;
39use crate::function::HostImportFunction;
40use crate::function::WasmExportFunction;
41
42use marine_wasm_backend_traits::prelude::*;
43
44#[derive(Default, Clone)]
45pub struct JsWasmBackend {}
46
47impl WasmBackend for JsWasmBackend {
48    type Store = JsStore;
49    type Module = JsModule;
50    type Imports = JsImports;
51    type Instance = JsInstance;
52    type Context<'c> = JsContext<'c>;
53    type ContextMut<'c> = JsContextMut<'c>;
54    type ImportCallContext<'c> = JsImportCallContext;
55    type HostFunction = HostImportFunction;
56    type ExportFunction = WasmExportFunction;
57    type Memory = JsMemory;
58    type MemoryView = JsMemory;
59    type Wasi = JsWasi;
60
61    fn new_async() -> WasmBackendResult<Self> {
62        Ok(Self {})
63    }
64}