Skip to main content

wasmer_interface_types_fl/
lib.rs

1//! This crate contains an implementation of [WebAssembly Interface
2//! Types][wit] (abbreviated WIT). It is composed of 5 parts:
3//!
4//! 1. [Types] and [Values]: To represent the WIT types and values
5//!    representations,
6//! 2. [AST]: To represent the WIT language as a tree
7//!    (which is not really abstract). This is the central
8//!    representation of the language.
9//! 3. [Decoders](decoders): To read the [AST] from a particular data
10//!    representation; for instance, [`decoders::binary::parse`] reads
11//!    the [AST] from a binary.
12//! 4. [Encoders](encoders): To write the [AST](ast) into a particular
13//!    format; for instance, [`encoders::wat`] writes the [AST] into a
14//!    string representing WIT with its textual format.
15//! 5. [Interpreter](interpreter): WIT defines a concept called
16//!    Adapters. An adapter contains a set of [instructions]. So, in
17//!    more details, this module contains:
18//!     * [A very light and generic stack
19//!       implementation](interpreter::stack), exposing only the
20//!       operations required by the interpreter,
21//!     * [A stack-based interpreter](interpreter::Interpreter),
22//!       defined by:
23//!          * A compiler that transforms a set of instructions into a
24//!            set of executable instructions,
25//!          * A stack,
26//!          * A runtime that holds the “invocation inputs” (arguments
27//!            of the interpreter), the stack, and the WebAssembly
28//!            instance (which holds the exports, the imports, the
29//!            memories, the tables etc.),
30//!     * [An hypothetic WebAssembly runtime](interpreter::wasm),
31//!       represented as a set of enums, types, and traits —basically
32//!       this is the part a runtime should take a look to use the
33//!       `wasmer-interface-types` crate—.
34//!
35//! [wit]: https://github.com/WebAssembly/interface-types
36//! [Types]: types
37//! [Values]: values
38//! [AST]: ast
39//! [instructions]: interpreter::Instruction
40
41#![deny(
42    dead_code,
43    missing_docs,
44    nonstandard_style,
45    unreachable_patterns,
46    unused_imports,
47    unused_mut,
48    unused_unsafe,
49    unused_variables
50)]
51// #![forbid(unsafe_code)]
52#![doc(html_favicon_url = "https://wasmer.io/static/icons/favicon.ico")]
53#![doc(html_logo_url = "https://github.com/wasmerio.png")]
54
55pub mod ast;
56#[macro_use]
57pub mod macros;
58pub mod decoders;
59pub mod encoders;
60pub mod errors;
61pub mod interpreter;
62#[cfg(feature = "serde")]
63mod serde;
64mod values;
65
66// re-exports
67pub use fluence_it_types::ne_vec;
68pub use fluence_it_types::ne_vec::NEVec;
69pub use fluence_it_types::IRecordFieldType;
70pub use fluence_it_types::IRecordType;
71pub use fluence_it_types::IType;
72pub use fluence_it_types::IValue;
73
74pub use it_to_bytes::ToBytes;
75
76#[cfg(feature = "serde")]
77pub use crate::serde::de::from_interface_values;
78
79#[cfg(feature = "serde")]
80pub use crate::serde::ser::to_interface_value;