Crate wasm_nm [] [src]

Build Status

List the symbols within a wasm file.

Executable

To install the wasm-nm executable, run

$ cargo install wasm-nm

For information on using the wasm-nm executable, run

$ wasm-nm --help

Using wasm-nm as a Size Profiler

wasm-nm can function as a rudimentary size profiler for .wasm files.

The -z option enables printing a function's code size. The unix sort utility can be used to sort the symbols by size. The rustfilt utility can be used to demangle Rust symbols (cargo install rustfilt).

$ wasm-nm -z path/to/something.wasm | sort -n -u -r | rustfilt | head
3578 p dlmalloc::dlmalloc::Dlmalloc::malloc::hb37c2fafc9847520
3307 e quicksilver
1427 p <str as core::fmt::Debug>::fmt::h0cf4ea19d7121472
1287 p std::panicking::rust_panic_with_hook::h52b2005910c55f47
1268 p core::fmt::Formatter::pad::hdb2be9f507201bd1
1248 p core::str::slice_error_fail::h09ffe3974e261c49
1064 p core::fmt::write::h914fcaafc6fb200a
987 p core::fmt::Formatter::pad_integral::h2f2f83d99c318b28
945 p <&'a T as core::fmt::Debug>::fmt::h4a5a01d440d30f67
918 p dlmalloc::dlmalloc::Dlmalloc::free::h8185738df2a87b48

Library

To use wasm-nm as a library, add this to your Cargo.toml:

[dependencies.wasm-nm]
# Do not build the executable.
default-features = false

See docs.rs/wasm-nm for API documentation.

License

Licensed under either of

at your option.

Contributing

See CONTRIBUTING.md for hacking.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Structs

Options

Options for controlling which symbols are iterated over.

Symbols

The set of symbols in a wasm file.

SymbolsIter

An iterator returned by Symbols::iter, which iterates over the symbols in a wasm file.

Enums

Symbol

A symbol from a wasm file.

Functions

symbols

Get the symbols in the given wasm file.