Sha256: e9eb076367cc0932e2a32651372defa4a27ef800f47fad28c0ef840ba8ea7e08

Contents?: true

Size: 1.03 KB

Versions: 52

Compression:

Stored size: 1.03 KB

Contents

use anyhow::Result;
use std::env;
use wasmparser::{Parser, Payload};

fn main() -> Result<()> {
    let args = env::args().collect::<Vec<_>>();
    if args.len() != 2 {
        println!("Usage: {} in.wasm", args[0]);
        return Ok(());
    }

    let buf: Vec<u8> = std::fs::read(&args[1])?;
    for payload in Parser::new(0).parse_all(&buf) {
        match payload? {
            Payload::Version { .. } => {
                println!("====== Module");
            }
            Payload::ExportSection(s) => {
                for export in s {
                    let export = export?;
                    println!("  Export {} {:?}", export.name, export.kind);
                }
            }
            Payload::ImportSection(s) => {
                for import in s {
                    let import = import?;
                    println!("  Import {}::{}", import.module, import.name);
                }
            }
            _other => {
                // println!("found payload {:?}", _other);
            }
        }
    }

    Ok(())
}

Version data entries

52 entries across 39 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/wasmparser-0.224.1/examples/simple.rs
wasmtime-30.0.2 ./ext/cargo-vendor/wasmparser-0.226.0/examples/simple.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/examples/simple.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmparser-0.224.0/examples/simple.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.221.2/examples/simple.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmparser-0.223.0/examples/simple.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.220.0/examples/simple.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/examples/simple.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.218.0/examples/simple.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmparser-0.219.1/examples/simple.rs
wasmtime-25.0.2 ./ext/cargo-vendor/wasmparser-0.217.0/examples/simple.rs
wasmtime-25.0.1 ./ext/cargo-vendor/wasmparser-0.217.0/examples/simple.rs
wasmtime-25.0.0 ./ext/cargo-vendor/wasmparser-0.217.0/examples/simple.rs
wasmtime-24.0.0 ./ext/cargo-vendor/wasmparser-0.215.0/examples/simple.rs
wasmtime-23.0.2 ./ext/cargo-vendor/wasmparser-0.212.0/examples/simple.rs
wasmtime-22.0.0 ./ext/cargo-vendor/wasmparser-0.209.1/examples/simple.rs
wasmtime-21.0.1 ./ext/cargo-vendor/wasmparser-0.207.0/examples/simple.rs
wasmtime-20.0.2 ./ext/cargo-vendor/wasmparser-0.202.0/examples/simple.rs
wasmtime-20.0.0 ./ext/cargo-vendor/wasmparser-0.202.0/examples/simple.rs
wasmtime-18.0.3 ./ext/cargo-vendor/wasmparser-0.121.2/examples/simple.rs