1pub mod hostcalls;
16pub mod traits;
17pub mod types;
18
19mod allocator;
20mod dispatcher;
21mod logger;
22
23#[cfg(not(wasi_exec_model_reactor))]
25#[macro_export]
26macro_rules! main {
27 ($code:block) => {
28 #[cfg(target_os = "wasi")]
29 extern "C" {
30 fn __wasm_call_ctors();
31 }
32
33 #[no_mangle]
34 pub extern "C" fn _initialize() {
35 #[cfg(target_os = "wasi")]
36 unsafe {
37 __wasm_call_ctors();
38 }
39
40 $code;
41 }
42 };
43}
44
45#[cfg(wasi_exec_model_reactor)]
47#[macro_export]
48macro_rules! main {
49 ($code:block) => {
50 pub fn main() -> Result<(), Box<dyn std::error::Error>> {
51 $code;
52 Ok(())
53 }
54 };
55}
56
57pub fn set_log_level(level: types::LogLevel) {
58 logger::set_log_level(level);
59}
60
61pub fn set_root_context(callback: types::NewRootContext) {
62 dispatcher::set_root_context(callback);
63}
64
65pub fn set_stream_context(callback: types::NewStreamContext) {
66 dispatcher::set_stream_context(callback);
67}
68
69pub fn set_http_context(callback: types::NewHttpContext) {
70 dispatcher::set_http_context(callback);
71}
72
73#[no_mangle]
74pub extern "C" fn proxy_abi_version_0_2_1() {}