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-29.0.0 ./ext/cargo-vendor/wast-224.0.0/src/component/custom.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wast-223.0.0/src/component/custom.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wast-220.0.0/src/component/custom.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wast-219.0.1/src/component/custom.rs
wasmtime-25.0.2 ./ext/cargo-vendor/wast-218.0.0/src/component/custom.rs
wasmtime-25.0.1 ./ext/cargo-vendor/wast-217.0.0/src/component/custom.rs
wasmtime-25.0.0 ./ext/cargo-vendor/wast-217.0.0/src/component/custom.rs
wasmtime-24.0.0 ./ext/cargo-vendor/wast-216.0.0/src/component/custom.rs
wasmtime-23.0.2 ./ext/cargo-vendor/wast-215.0.0/src/component/custom.rs
wasmtime-22.0.0 ./ext/cargo-vendor/wast-209.0.1/src/component/custom.rs
wasmtime-21.0.1 ./ext/cargo-vendor/wast-209.0.1/src/component/custom.rs
wasmtime-20.0.2 ./ext/cargo-vendor/wast-209.0.1/src/component/custom.rs
wasmtime-20.0.0 ./ext/cargo-vendor/wast-208.0.1/src/component/custom.rs
wasmtime-18.0.3 ./ext/cargo-vendor/wast-201.0.0/src/component/custom.rs
wasmtime-17.0.1 ./ext/cargo-vendor/wast-69.0.1/src/component/custom.rs
wasmtime-17.0.0 ./ext/cargo-vendor/wast-69.0.1/src/component/custom.rs
wasmtime-16.0.0 ./ext/cargo-vendor/wast-69.0.1/src/component/custom.rs
wasmtime-15.0.1 ./ext/cargo-vendor/wast-69.0.1/src/component/custom.rs
wasmtime-15.0.0 ./ext/cargo-vendor/wast-69.0.1/src/component/custom.rs
wasmtime-14.0.4 ./ext/cargo-vendor/wast-67.0.1/src/component/custom.rs