1#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
9#![warn(unused_import_braces)]
10#![cfg_attr(not(feature = "std"), no_std)]
11#![allow(clippy::new_without_default, clippy::upper_case_acronyms)]
12#![warn(
13 clippy::float_arithmetic,
14 clippy::mut_mut,
15 clippy::nonminimal_bool,
16 clippy::map_unwrap_or,
17 clippy::print_stdout,
18 clippy::unicode_not_nfc,
19 clippy::use_self
20)]
21#![cfg_attr(docsrs, feature(doc_cfg))]
22
23macro_rules! cfg_std_or_core {
24 ($($item:item)*) => {
25 $(
26 #[cfg(any(
27 feature = "std",
28 feature = "core",
29 ))]
30 $item
31 )*
32 };
33}
34
35#[cfg(all(feature = "std", feature = "core"))]
36compile_error!(
37 "The `std` and `core` features are both enabled, which is an error. Please enable only once."
38);
39
40#[cfg(all(not(feature = "std"), not(feature = "core")))]
41compile_error!("Both the `std` and `core` features are disabled. Please enable one of them.");
42
43#[cfg(feature = "core")]
44extern crate alloc;
45
46#[allow(unused_imports)]
47#[cfg(any(feature = "std", feature = "core"))]
48mod lib {
49 #[cfg(feature = "core")]
50 pub mod std {
51 pub use alloc::{borrow, boxed, str, string, sync, vec};
52 pub use core::fmt;
53 pub use hashbrown as collections;
54 }
55
56 #[cfg(feature = "std")]
57 pub mod std {
58 pub use std::{borrow, boxed, collections, fmt, str, string, sync, vec};
59 }
60}
61
62cfg_std_or_core! {
63 mod engine;
64 mod traits;
65
66 pub mod abi;
67 pub mod misc;
68 pub mod object;
69 pub mod progress;
70 pub mod serialize;
71 pub mod types;
72
73 pub use crate::engine::*;
74 pub use crate::traits::*;
75
76 mod artifact_builders;
77
78 pub use self::artifact_builders::*;
79}
80
81#[cfg(feature = "compiler")]
82mod compiler;
83#[cfg(feature = "compiler")]
84pub use crate::compiler::{
85 CompiledFunction, CompiledObjects, Compiler, CompilerConfig, FuncTranslator, FunctionBucket,
86 WASM_LARGE_FUNCTION_THRESHOLD, WASM_TRAMPOLINE_ESTIMATED_BODY_SIZE, build_function_buckets,
87 emit_metadata_and_link, translate_function_buckets,
88};
89
90#[cfg(feature = "compiler")]
91pub mod dwarf;
92#[cfg(feature = "compiler")]
93pub mod elf;
94
95mod constants;
96pub use crate::constants::*;
97
98#[cfg(feature = "translator")]
99#[macro_use]
100mod translator;
101#[cfg(feature = "translator")]
102pub use crate::translator::{
103 FunctionBinaryReader, FunctionBodyData, FunctionMiddleware, MiddlewareBinaryReader,
104 MiddlewareReaderState, ModuleEnvironment, ModuleMiddleware, ModuleMiddlewareChain,
105 ModuleTranslationState, from_binaryreadererror_wasmerror, translate_module, wpheaptype_to_type,
106 wptype_to_type,
107};
108
109pub use wasmer_types::{Addend, CodeOffset, Features};
110
111#[cfg(feature = "translator")]
112pub use wasmparser;
114
115pub const VERSION: &str = env!("CARGO_PKG_VERSION");