Sha256: f5b23c34b73a716a986fd999fc8d8c9e24c341e83292088fe83325cd82dab4f5

Contents?: true

Size: 718 Bytes

Versions: 38

Compression:

Stored size: 718 Bytes

Contents

use crate::annotation;
use crate::parser::{Parse, Parser, Result};
use crate::token::Span;

/// A custom section within a component.
#[derive(Debug)]
pub struct Custom<'a> {
    /// Where this `@custom` was defined.
    pub span: Span,

    /// Name of the custom section.
    pub name: &'a str,

    /// Payload of this custom section.
    pub data: Vec<&'a [u8]>,
}

impl<'a> Parse<'a> for Custom<'a> {
    fn parse(parser: Parser<'a>) -> Result<Self> {
        let span = parser.parse::<annotation::custom>()?.0;
        let name = parser.parse()?;
        let mut data = Vec::new();
        while !parser.is_empty() {
            data.push(parser.parse()?);
        }
        Ok(Self { span, name, data })
    }
}

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
wasmtime-14.0.3 ./ext/cargo-vendor/wast-66.0.2/src/component/custom.rs
wasmtime-14.0.1 ./ext/cargo-vendor/wast-66.0.2/src/component/custom.rs
wasmtime-14.0.0 ./ext/cargo-vendor/wast-66.0.2/src/component/custom.rs
wasmtime-13.0.0 ./ext/cargo-vendor/wast-65.0.1/src/component/custom.rs
wasmtime-12.0.1 ./ext/cargo-vendor/wast-63.0.0/src/component/custom.rs
wasmtime-12.0.0 ./ext/cargo-vendor/wast-63.0.0/src/component/custom.rs
wasmtime-11.0.0 ./ext/cargo-vendor/wast-63.0.0/src/component/custom.rs
wasmtime-10.0.1 ./ext/cargo-vendor/wast-62.0.1/src/component/custom.rs
wasmtime-10.0.0 ./ext/cargo-vendor/wast-62.0.1/src/component/custom.rs
wasmtime-9.0.4 ./ext/cargo-vendor/wast-62.0.1/src/component/custom.rs
wasmtime-9.0.1 ./ext/cargo-vendor/wast-58.0.0/src/component/custom.rs
wasmtime-8.0.0 ./ext/cargo-vendor/wast-56.0.0/src/component/custom.rs
wasmtime-7.0.0 ./ext/cargo-vendor/wast-55.0.0/src/component/custom.rs
wasmtime-6.0.1 ./ext/cargo-vendor/wast-54.0.1/src/component/custom.rs
wasmtime-6.0.0 ./ext/cargo-vendor/wast-54.0.1/src/component/custom.rs
wasmtime-5.0.0 ./ext/cargo-vendor/wast-52.0.1/src/component/custom.rs
wasmtime-0.4.1 ./ext/cargo-vendor/wast-50.0.0/src/component/custom.rs
wasmtime-0.4.0 ./ext/cargo-vendor/wast-50.0.0/src/component/custom.rs