Coverage Report

Created: 2026-10-31 07:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wasm-tools/crates/wasmparser/src/readers/component/start.rs
Line
Count
Source
1
use crate::limits::{MAX_WASM_FUNCTION_RETURNS, MAX_WASM_START_ARGS};
2
use crate::prelude::*;
3
use crate::{BinaryReader, FromReader, Result};
4
5
/// Represents the start function in a WebAssembly component.
6
#[derive(Debug, Clone)]
7
pub struct ComponentStartFunction {
8
    /// The index to the start function.
9
    pub func_index: u32,
10
    /// The start function arguments.
11
    ///
12
    /// The arguments are specified by value index.
13
    pub arguments: Box<[u32]>,
14
    /// The number of expected results for the start function.
15
    pub results: u32,
16
}
17
18
impl<'a> FromReader<'a> for ComponentStartFunction {
19
0
    fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> {
20
0
        let func_index = reader.read_var_u32()?;
21
0
        let arguments = reader
22
0
            .read_iter(MAX_WASM_START_ARGS, "start function arguments")?
23
0
            .collect::<Result<_>>()?;
24
0
        let results = reader.read_size(MAX_WASM_FUNCTION_RETURNS, "start function results")? as u32;
25
0
        Ok(ComponentStartFunction {
26
0
            func_index,
27
0
            arguments,
28
0
            results,
29
0
        })
30
0
    }
31
}