Sha256: 8f21463b58cf06246085a055c363c4aca58a896e6b3cf2e4bc9ee4198b31fa8f

Contents?: true

Size: 791 Bytes

Versions: 4

Compression:

Stored size: 791 Bytes

Contents

use crate::{Component, ComponentSection, ComponentSectionId, Encode};
use alloc::vec::Vec;

/// An encoder for the component section of WebAssembly components.
///
/// # Example
///
/// ```rust
/// use wasm_encoder::{Component, NestedComponentSection};
///
/// let mut nested = Component::new();
/// let mut component = Component::new();
/// component.section(&NestedComponentSection(&nested));
///
/// let bytes = component.finish();
/// ```
#[derive(Clone, Debug)]
pub struct NestedComponentSection<'a>(pub &'a Component);

impl Encode for NestedComponentSection<'_> {
    fn encode(&self, sink: &mut Vec<u8>) {
        self.0.bytes.encode(sink);
    }
}

impl ComponentSection for NestedComponentSection<'_> {
    fn id(&self) -> u8 {
        ComponentSectionId::Component.into()
    }
}

Version data entries

4 entries across 3 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/wasm-encoder-0.224.1/src/component/components.rs
wasmtime-30.0.2 ./ext/cargo-vendor/wasm-encoder-0.226.0/src/component/components.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasm-encoder-0.224.0/src/component/components.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasm-encoder-0.223.0/src/component/components.rs