wasm/
lib.rs

1#![no_std]
2#![deny(clippy::undocumented_unsafe_blocks)]
3
4extern crate alloc;
5#[macro_use]
6extern crate log;
7
8pub use core::error::ValidationError;
9pub use core::reader::types::{export::ExportDesc, Limits, NumType, RefType, ValType};
10pub use core::rw_spinlock;
11pub use execution::error::{RuntimeError, TrapError};
12pub use execution::store::*;
13pub use execution::value::Value;
14pub use execution::*;
15pub use validation::*;
16
17pub(crate) mod core;
18pub(crate) mod execution;
19pub(crate) mod validation;
20
21/// A definition for a [`Result`] using the optional [`Error`] type.
22pub type Result<T> = ::core::result::Result<T, Error>;
23
24/// An opt-in error type useful for merging all error types of this crate into a single type.
25///
26/// Note: This crate does not use this type in any public interfaces, making it optional for downstream users.
27pub enum Error {
28    Validation(ValidationError),
29    RuntimeError(RuntimeError),
30}
31
32impl From<ValidationError> for Error {
33    fn from(value: ValidationError) -> Self {
34        Self::Validation(value)
35    }
36}
37
38impl From<RuntimeError> for Error {
39    fn from(value: RuntimeError) -> Self {
40        Self::RuntimeError(value)
41    }
42}