1 #![cfg_attr(docsrs, doc(cfg(feature = "runtime")))]
2 
3 #[macro_use]
4 pub(crate) mod func;
5 
6 pub(crate) mod code;
7 pub(crate) mod code_memory;
8 pub(crate) mod debug;
9 pub(crate) mod externals;
10 pub(crate) mod gc;
11 pub(crate) mod instance;
12 pub(crate) mod instantiate;
13 pub(crate) mod limits;
14 pub(crate) mod linker;
15 pub(crate) mod memory;
16 pub(crate) mod module;
17 pub(crate) mod profiling;
18 pub(crate) mod resources;
19 pub(crate) mod store;
20 pub(crate) mod trampoline;
21 pub(crate) mod trap;
22 pub(crate) mod type_registry;
23 pub(crate) mod types;
24 pub(crate) mod uninhabited;
25 pub(crate) mod v128;
26 pub(crate) mod values;
27 
28 #[cfg(feature = "component-model")]
29 pub mod component;
30 
31 #[cfg(feature = "async")]
32 pub(crate) mod stack;
33 
34 #[cfg(feature = "coredump")]
35 mod coredump;
36 
37 cfg_if::cfg_if! {
38     if #[cfg(miri)] {
39         // no extensions on miri
40     } else if #[cfg(unix)] {
41         pub mod unix;
42     } else if #[cfg(windows)] {
43         pub mod windows;
44     } else {
45         // ... unknown os!
46     }
47 }
48 
49 pub use code_memory::CodeMemory;
50 pub use externals::*;
51 pub use func::*;
52 pub use gc::*;
53 pub use instance::{Instance, InstancePre};
54 pub use instantiate::CompiledModule;
55 pub use limits::*;
56 pub use linker::*;
57 pub use memory::*;
58 pub use module::{Module, ModuleExport};
59 pub use resources::*;
60 #[cfg(feature = "async")]
61 pub use store::CallHookHandler;
62 pub use store::{
63     AsContext, AsContextMut, CallHook, Store, StoreContext, StoreContextMut, UpdateDeadline,
64 };
65 pub use trap::*;
66 pub use types::*;
67 pub use v128::V128;
68 pub use values::*;
69 
70 pub(crate) use uninhabited::*;
71 
72 #[cfg(feature = "profiling")]
73 pub use profiling::GuestProfiler;
74 
75 #[cfg(feature = "async")]
76 pub use stack::*;
77 
78 #[cfg(feature = "coredump")]
79 pub use coredump::*;
80 
81 fn _assertions_runtime() {
82     use crate::_assert_send_and_sync;
83 
84     #[cfg(feature = "async")]
85     fn _assert_send<T: Send>(_t: T) {}
86 
87     _assert_send_and_sync::<Caller<'_, ()>>();
88     _assert_send_and_sync::<ExternRef>();
89     _assert_send_and_sync::<(Func, TypedFunc<(), ()>, Global, Table, Memory)>();
90     _assert_send_and_sync::<Instance>();
91     _assert_send_and_sync::<InstancePre<()>>();
92     _assert_send_and_sync::<InstancePre<*mut u8>>();
93     _assert_send_and_sync::<Linker<()>>();
94     _assert_send_and_sync::<Linker<*mut u8>>();
95     _assert_send_and_sync::<Module>();
96     _assert_send_and_sync::<Store<()>>();
97     _assert_send_and_sync::<StoreContext<'_, ()>>();
98     _assert_send_and_sync::<StoreContextMut<'_, ()>>();
99 
100     #[cfg(feature = "async")]
101     fn _call_async(s: &mut Store<()>, f: Func) {
102         _assert_send(f.call_async(&mut *s, &[], &mut []))
103     }
104     #[cfg(feature = "async")]
105     fn _typed_call_async(s: &mut Store<()>, f: TypedFunc<(), ()>) {
106         _assert_send(f.call_async(&mut *s, ()))
107     }
108     #[cfg(feature = "async")]
109     fn _instantiate_async(s: &mut Store<()>, m: &Module) {
110         _assert_send(Instance::new_async(s, m, &[]))
111     }
112 }
113