walrus 0.26.4

A library for performing WebAssembly transformations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! A small example which is primarily used to help benchmark walrus right now.

fn main() -> anyhow::Result<()> {
    env_logger::init();
    let a = std::env::args()
        .nth(1)
        .ok_or_else(|| anyhow::anyhow!("must provide the input wasm file as the first argument"))?;
    let mut m = walrus::Module::from_file(&a)?;
    let wasm = m.emit_wasm();
    if let Some(destination) = std::env::args().nth(2) {
        std::fs::write(destination, wasm)?;
    }
    Ok(())
}