polkavm/
lib.rs

1#![forbid(unused_must_use)]
2#![forbid(clippy::missing_safety_doc)]
3#![deny(clippy::undocumented_unsafe_blocks)]
4#![deny(clippy::exhaustive_structs)]
5
6#[cfg(all(
7    not(miri),
8    target_arch = "x86_64",
9    any(target_os = "linux", target_os = "macos", target_os = "freebsd")
10))]
11macro_rules! if_compiler_is_supported {
12    ({
13        $($if_true:tt)*
14    } else {
15        $($if_false:tt)*
16    }) => {
17        $($if_true)*
18    };
19
20    ($($if_true:tt)*) => {
21        $($if_true)*
22    }
23}
24
25#[cfg(not(all(
26    not(miri),
27    target_arch = "x86_64",
28    any(target_os = "linux", target_os = "macos", target_os = "freebsd")
29)))]
30macro_rules! if_compiler_is_supported {
31    ({
32        $($if_true:tt)*
33    } else {
34        $($if_false:tt)*
35    }) => {
36        $($if_false)*
37    };
38
39    ($($if_true:tt)*) => {}
40}
41
42mod error;
43
44mod api;
45mod caller;
46mod config;
47mod interpreter;
48mod source_cache;
49mod tracer;
50mod utils;
51
52if_compiler_is_supported! {
53    mod compiler;
54    mod sandbox;
55}
56
57pub use polkavm_common::{
58    abi::MemoryMap,
59    error::{ExecutionError, Trap},
60    program::{ProgramBlob, ProgramParseError, Reg},
61    utils::{AsUninitSliceMut, Gas},
62};
63
64pub use crate::api::{CallArgs, Engine, ExportIndex, Instance, InstancePre, Linker, Module, StateArgs};
65pub use crate::caller::{Caller, CallerRef};
66pub use crate::config::{BackendKind, Config, GasMeteringKind, ModuleConfig, SandboxKind};
67pub use crate::error::Error;
68
69#[cfg(test)]
70mod tests;