Sha256: 9c37d1eea486ee951547a328693bcf9f2a27f48e2207478daf23c1cd9e9f95f3

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

use crate::limits::{MAX_WASM_FUNCTION_RETURNS, MAX_WASM_START_ARGS};
use crate::prelude::*;
use crate::{BinaryReader, FromReader, Result};

/// Represents the start function in a WebAssembly component.
#[derive(Debug, Clone)]
pub struct ComponentStartFunction {
    /// The index to the start function.
    pub func_index: u32,
    /// The start function arguments.
    ///
    /// The arguments are specified by value index.
    pub arguments: Box<[u32]>,
    /// The number of expected results for the start function.
    pub results: u32,
}

impl<'a> FromReader<'a> for ComponentStartFunction {
    fn from_reader(reader: &mut BinaryReader<'a>) -> Result<Self> {
        let func_index = reader.read_var_u32()?;
        let arguments = reader
            .read_iter(MAX_WASM_START_ARGS, "start function arguments")?
            .collect::<Result<_>>()?;
        let results = reader.read_size(MAX_WASM_FUNCTION_RETURNS, "start function results")? as u32;
        Ok(ComponentStartFunction {
            func_index,
            arguments,
            results,
        })
    }
}

Version data entries

17 entries across 12 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/wasmparser-0.226.0/src/readers/component/start.rs
wasmtime-30.0.2 ./ext/cargo-vendor/wasmparser-0.224.1/src/readers/component/start.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/src/readers/component/start.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.224.0/src/readers/component/start.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.223.0/src/readers/component/start.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/src/readers/component/start.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.220.0/src/readers/component/start.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/src/readers/component/start.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.218.0/src/readers/component/start.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/src/readers/component/start.rs
wasmtime-25.0.2 ./ext/cargo-vendor/wasmparser-0.217.0/src/readers/component/start.rs
wasmtime-25.0.1 ./ext/cargo-vendor/wasmparser-0.217.0/src/readers/component/start.rs
wasmtime-25.0.0 ./ext/cargo-vendor/wasmparser-0.217.0/src/readers/component/start.rs
wasmtime-24.0.0 ./ext/cargo-vendor/wasmparser-0.215.0/src/readers/component/start.rs
wasmtime-23.0.2 ./ext/cargo-vendor/wasmparser-0.212.0/src/readers/component/start.rs
wasmtime-22.0.0 ./ext/cargo-vendor/wasmparser-0.209.1/src/readers/component/start.rs
wasmtime-21.0.1 ./ext/cargo-vendor/wasmparser-0.207.0/src/readers/component/start.rs