/build/source/src/execution/execution_info.rs
Line | Count | Source |
1 | | use alloc::string::{String, ToString}; |
2 | | use alloc::vec::Vec; |
3 | | |
4 | | use crate::core::reader::types::FuncType; |
5 | | use crate::core::reader::WasmReader; |
6 | | use crate::execution::Store; |
7 | | |
8 | | /// ExecutionInfo is a compilation of relevant information needed by the [interpreter loop]( |
9 | | /// crate::execution::interpreter_loop::run). The lifetime annotation `'r` represents that this structure needs to be |
10 | | /// valid at least as long as the [RuntimeInstance](crate::execution::RuntimeInstance) that creates it. |
11 | | pub struct ExecutionInfo<'r> { |
12 | | pub name: String, |
13 | | pub wasm_bytecode: &'r [u8], |
14 | | pub wasm_reader: WasmReader<'r>, |
15 | | pub fn_types: Vec<FuncType>, |
16 | | pub store: Store, |
17 | | } |
18 | | |
19 | | impl<'r> ExecutionInfo<'r> { |
20 | 278 | pub fn new(name: &str, wasm_bytecode: &'r [u8], fn_types: Vec<FuncType>, store: Store) -> Self { |
21 | 278 | ExecutionInfo { |
22 | 278 | name: name.to_string(), |
23 | 278 | wasm_bytecode, |
24 | 278 | wasm_reader: WasmReader::new(wasm_bytecode), |
25 | 278 | fn_types, |
26 | 278 | store, |
27 | 278 | } |
28 | 278 | } |
29 | | } |