doc(interface-types) Add intra links.

This commit is contained in:
Ivan Enderlin 2020-02-21 12:23:58 +01:00
parent bae5cfbbe3
commit ea855d29bd
5 changed files with 31 additions and 24 deletions

View File

@ -5,7 +5,7 @@ use crate::interpreter::Instruction;
use std::str;
/// Represents the types supported by WIT.
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Debug)]
pub enum InterfaceType {
/// An integer.
Int,

View File

@ -1,4 +1,4 @@
//! Parse the WIT binary representation into an AST.
//! Parse the WIT binary representation into an [AST](crate::ast).
use crate::{ast::*, interpreter::Instruction};
use nom::{
@ -408,7 +408,8 @@ fn forwards<'input, E: ParseError<&'input [u8]>>(
}
/// Parse a sequence of bytes, expecting it to be a valid WIT binary
/// representation, into an `ast::Interfaces`.
/// representation, into an [`Interfaces`](crate::ast::Interfaces)
/// structure.
///
/// # Example
///

View File

@ -1,5 +1,6 @@
//! Reads the AST from a particular data representation; for instance,
//! `decoders::binary` reads the AST from a binary.
//! [`decoders::binary`](binary) reads the [AST](crate::ast)
//! from a binary.
pub mod binary;
pub mod wat;

View File

@ -43,8 +43,8 @@ pub(crate) type ExecutableInstruction<Instance, Export, LocalImport, Memory, Mem
/// An interpreter is the central piece of this crate. It is a set of
/// executable instructions. Each instruction takes the runtime as
/// argument. The runtime holds the invocation inputs, the stack, and
/// the WebAssembly instance.
/// argument. The runtime holds the invocation inputs, [the
/// stack](stack), and [the WebAssembly instance](wasm).
///
/// When the interpreter executes the instructions, each of them can
/// query the WebAssembly instance, operates on the stack, or reads

View File

@ -1,21 +1,23 @@
//! This crate contains an implementation of [WebAssembly Interface
//! Types][wit] (abbreviated WIT). It is composed of 4 parts:
//!
//! 1. AST: To represent the WIT language as a tree (which is not
//! really abstract). This is the central representation of the
//! language.
//! 2. Decoders: To read the AST from a particular data representation;
//! for instance, `decoders::binary` reads the AST from a binary.
//! 3. Encoders: To write the AST into a particular format; for
//! instance, `encoders::wat` writes the AST into a string
//! representing WIT with its textual format.
//! 4. Interpreter: WIT defines a concept called Adapters. An adapter
//! contains a set of instructions. So, in more details, this
//! module contains:
//! * A very light and generic stack implementation, exposing only
//! the operations required by the interpreter,
//! * A stack-based interpreter, defined by:
//! 1. [AST]: To represent the WIT language as a tree
//! (which is not really abstract). This is the central
//! representation of the language.
//! 2. [Decoders](decoders): To read the [AST] from a particular data
//! representation; for instance, [`decoders::binary`] reads the
//! [AST] from a binary.
//! 3. [Encoders](encoders): To write the [AST](ast) into a particular
//! format; for instance, [`encoders::wat`] writes the [AST] into a
//! string representing WIT with its textual format.
//! 4. [Interpreter](interpreter): WIT defines a concept called
//! Adapters. An adapter contains a set of [instructions]. So, in
//! more details, this module contains:
//! * [A very light and generic stack
//! implementation](interpreter::stack), exposing only the
//! operations required by the interpreter,
//! * [A stack-based interpreter](interpreter::Interpreter),
//! defined by:
//! * A compiler that transforms a set of instructions into a
//! set of executable instructions,
//! * A stack,
@ -23,16 +25,19 @@
//! of the interpreter), the stack, and the WebAssembly
//! instance (which holds the exports, the imports, the
//! memories, the tables etc.),
//! * An hypothetic WebAssembly runtime, represented as a set of
//! enums, types, and traits —basically this is the part a
//! runtime should take a look to use the
//! * [An hypothetic WebAssembly runtime](interpreter::wasm),
//! represented as a set of enums, types, and traits —basically
//! this is the part a runtime should take a look to use the
//! `wasmer-interface-types` crate—.
//!
//!
//! [wit]: https://github.com/WebAssembly/interface-types
//! [AST]: ast
//! [instructions]: interpreter::Instruction
#![deny(
dead_code,
intra_doc_link_resolution_failure,
missing_docs,
nonstandard_style,
unreachable_patterns,