Sha256: 2b5aa5add7b0e0c3f792cd48a2e7e5f9b145bd7330f7b4ba8b3f3af2205e4f9b
Contents?: true
Size: 743 Bytes
Versions: 4
Compression:
Stored size: 743 Bytes
Contents
use crate::{ComponentSection, ComponentSectionId, Encode, Module}; use alloc::vec::Vec; /// An encoder for the module section of WebAssembly components. /// /// # Example /// /// ```rust /// use wasm_encoder::{Module, Component, ModuleSection}; /// /// let mut module = Module::new(); /// let mut component = Component::new(); /// component.section(&ModuleSection(&module)); /// /// let bytes = component.finish(); /// ``` #[derive(Clone, Debug)] pub struct ModuleSection<'a>(pub &'a Module); impl Encode for ModuleSection<'_> { fn encode(&self, sink: &mut Vec<u8>) { self.0.bytes.encode(sink); } } impl ComponentSection for ModuleSection<'_> { fn id(&self) -> u8 { ComponentSectionId::CoreModule.into() } }
Version data entries
4 entries across 3 versions & 1 rubygems