//! Represents the WIT language as a tree. This is the central //! representation of the language. use crate::interpreter::Instruction; use std::str; #[derive(PartialEq, Clone, Debug)] pub enum InterfaceType { Int, Float, Any, String, Seq, I32, I64, F32, F64, AnyRef, } #[derive(PartialEq, Debug)] pub(crate) enum AdapterKind { Import, Export, HelperFunction, } #[derive(PartialEq, Debug)] pub struct Export<'input> { pub name: &'input str, pub input_types: Vec, pub output_types: Vec, } #[derive(PartialEq, Debug)] pub struct Type<'input> { pub name: &'input str, pub fields: Vec<&'input str>, pub types: Vec, } #[derive(PartialEq, Debug)] pub struct ImportedFunction<'input> { pub namespace: &'input str, pub name: &'input str, pub input_types: Vec, pub output_types: Vec, } #[derive(PartialEq, Debug)] pub enum Adapter<'input> { Import { namespace: &'input str, name: &'input str, input_types: Vec, output_types: Vec, instructions: Vec>, }, Export { name: &'input str, input_types: Vec, output_types: Vec, instructions: Vec>, }, HelperFunction { name: &'input str, input_types: Vec, output_types: Vec, instructions: Vec>, }, } #[derive(PartialEq, Debug)] pub struct Forward<'input> { pub name: &'input str, } #[derive(PartialEq, Debug)] pub struct Interfaces<'input> { pub exports: Vec>, pub types: Vec>, pub imported_functions: Vec>, pub adapters: Vec>, pub forwards: Vec>, }