31 lines
932 B
Rust
Raw Normal View History

2017-03-30 20:55:25 +03:00
extern crate parity_wasm;
use std::env;
use parity_wasm::Section;
fn main() {
let args = env::args().collect::<Vec<_>>();
if args.len() != 2 {
println!("Usage: {} somefile.wasm", args[0]);
return;
}
let module = parity_wasm::deserialize_file(&args[1]).expect("Failed to load module");
println!("Module sections: {}", module.sections().len());
for section in module.sections() {
match section {
&Section::Import(ref import_section) => {
println!("Imports {}", import_section.entries().len());
},
2017-03-31 01:54:04 +03:00
&Section::Export(ref exports_section) => {
println!("Exports {}", exports_section.entries().len());
},
2017-03-30 23:23:54 +03:00
&Section::Function(ref functions_section) => {
println!("Functions {}", functions_section.entries().len());
},
2017-03-30 20:55:25 +03:00
_ => {},
}
}
}