marine_core/
lib.rs

1/*
2 * Copyright 2020 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#![warn(rust_2018_idioms)]
17#![feature(get_mut_unchecked)]
18#![feature(new_uninit)]
19#![feature(stmt_expr_attributes)]
20#![deny(
21    dead_code,
22    nonstandard_style,
23    unused_imports,
24    unused_mut,
25    unused_variables,
26    unused_unsafe,
27    unreachable_patterns
28)]
29
30mod config;
31mod marine_core;
32mod errors;
33mod host_imports;
34mod misc;
35mod module;
36mod memory_statistic;
37
38pub use crate::marine_core::MModuleInterface;
39pub use config::MarineCoreConfig;
40pub use config::INFINITE_MEMORY_LIMIT;
41pub use config::HostAPIVersion;
42pub use errors::MError;
43pub use host_imports::HostImportError;
44pub use module::IValue;
45pub use module::IRecordType;
46pub use module::IFunctionArg;
47pub use module::IType;
48pub use module::MRecordTypes;
49pub use module::MFunctionSignature;
50pub use module::from_interface_values;
51pub use module::to_interface_value;
52pub use memory_statistic::ModuleMemoryStat;
53pub use memory_statistic::MemoryStats;
54
55pub use wasmer_it::IRecordFieldType;
56pub mod ne_vec {
57    pub use wasmer_it::NEVec;
58}
59
60pub(crate) type MResult<T> = std::result::Result<T, MError>;
61
62pub mod generic {
63    pub use crate::config::MModuleConfig;
64    pub use crate::config::HostExportedFunc;
65    pub use crate::config::HostImportDescriptor;
66    pub use crate::marine_core::MarineCore;
67}
68
69#[cfg(feature = "default")]
70pub mod wasmtime {
71    pub type WasmBackend = marine_wasmtime_backend::WasmtimeWasmBackend;
72
73    pub type MModuleConfig = crate::config::MModuleConfig<WasmBackend>;
74    pub type HostExportedFunc = crate::config::HostExportedFunc<WasmBackend>;
75    pub type HostImportDescriptor = crate::config::HostImportDescriptor<WasmBackend>;
76    pub type MarineCore = crate::marine_core::MarineCore<WasmBackend>;
77}
78
79#[cfg(feature = "default")]
80pub use crate::wasmtime::*;