wasm/core/decoding/modules/
element_section.rs

1use crate::{core::decoding::reader::WasmDecoder, DecodingError};
2
3pub struct ElemKind;
4
5impl ElemKind {
6    /// Decodes an element kind
7    ///
8    /// See: [WebAssembly Specification 2.0 - 5.5.12. Element Section](https://www.w3.org/TR/2025/CRD-wasm-core-2-20250616/#binary-elemkind).
9    pub fn decode(wasm: &mut WasmDecoder) -> Result<Self, DecodingError> {
10        let byte = wasm.decode_u8()?;
11
12        if byte != 0x00 {
13            return Err(DecodingError::MalformedElemKindDiscriminator(byte));
14        }
15
16        Ok(ElemKind)
17    }
18}