All Projects → rustwasm → Wasm Snip

rustwasm / Wasm Snip

`wasm-snip` replaces a WebAssembly function's body with an `unreachable`

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Wasm Snip

D3 Wasm Force
A re-implementation of d3-force with WebAssembly.
Stars: ✭ 93 (-24.39%)
Mutual labels:  wasm
Wasmplay
WASM Web "Framework" Playground
Stars: ✭ 105 (-14.63%)
Mutual labels:  wasm
Lunatic
Lunatic is an Erlang-inspired runtime for WebAssembly
Stars: ✭ 2,074 (+1586.18%)
Mutual labels:  wasm
Cs2x
Transpiles a C# subset to non .NET languages and runtimes. (Powered by Roslyn)
Stars: ✭ 97 (-21.14%)
Mutual labels:  wasm
Wasmer Go
🐹🕸️ WebAssembly runtime for Go
Stars: ✭ 1,365 (+1009.76%)
Mutual labels:  wasm
Kou
A minimal language compiled into wasm bytecode
Stars: ✭ 112 (-8.94%)
Mutual labels:  wasm
Dcmjs
dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Stars: ✭ 92 (-25.2%)
Mutual labels:  wasm
Go Wasm
WebAssembly binary file parser written in go
Stars: ✭ 121 (-1.63%)
Mutual labels:  wasm
Awesome Seed Rs
A curated list of awesome things related to Seed
Stars: ✭ 101 (-17.89%)
Mutual labels:  wasm
Aries Framework Go
Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
Stars: ✭ 118 (-4.07%)
Mutual labels:  wasm
Fundude
Gameboy emulator: Zig -> wasm
Stars: ✭ 98 (-20.33%)
Mutual labels:  wasm
Faust
Functional programming language for signal processing and sound synthesis
Stars: ✭ 1,360 (+1005.69%)
Mutual labels:  wasm
Tinysearch
🔍 Tiny, full-text search engine for static websites built with Rust and Wasm
Stars: ✭ 1,705 (+1286.18%)
Mutual labels:  wasm
Telegram React
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Stars: ✭ 1,332 (+982.93%)
Mutual labels:  wasm
Gbemu
WebAssembly based Gameboy Emulator
Stars: ✭ 120 (-2.44%)
Mutual labels:  wasm
Self Learning Materials For Blazor Jp
C# で Single Page Web アプリを開発するフレームワーク「Blazor」の WebAssembly 版 (client-side 版) の自習教材です。
Stars: ✭ 93 (-24.39%)
Mutual labels:  wasm
Deprecated rust wasm template
Deprecated in favor of rustwasm/wasm-pack-template or rustwasm/rust-webpack-template
Stars: ✭ 108 (-12.2%)
Mutual labels:  wasm
Rust Nes Emulator
NES Emulator written in Rust
Stars: ✭ 122 (-0.81%)
Mutual labels:  wasm
Blazorcrud
Demo application built with the Blazor client-side hosting model (WebAssembly) and .NET Core REST APIs secured by a JWT service.
Stars: ✭ 121 (-1.63%)
Mutual labels:  wasm
Blurhash Rust Wasm
A Rust and WASM implementation of the blurhash algorithm
Stars: ✭ 119 (-3.25%)
Mutual labels:  wasm

wasm-snip

wasm-snip replaces a Wasm function's body with an unreachable instruction.

Build Status Crates.io version Download docs.rs docs

API Docs | Contributing | Chat

Built with 🦀🕸 by The Rust and WebAssembly Working Group

About

wasm-snip replaces a WebAssembly function's body with an unreachable.

Maybe you know that some function will never be called at runtime, but the compiler can't prove that at compile time? Snip it! All the functions it transitively called — which weren't called by anything else and therefore could also never be called at runtime — will get removed too.

Very helpful when shrinking the size of WebAssembly binaries!

This functionality relies on the "name" section being present in the .wasm file, so build with debug symbols:

[profile.release]
debug = true

Executable

To install the wasm-snip executable, run

$ cargo install wasm-snip

You can use wasm-snip to remove the annoying_space_waster function from input.wasm and put the new binary in output.wasm like this:

$ wasm-snip input.wasm -o output.wasm annoying_space_waster

For information on using the wasm-snip executable, run

$ wasm-snip --help

And you'll get the most up-to-date help text, like:

Replace a wasm function with an `unreachable`.

USAGE:
wasm-snip [FLAGS] [OPTIONS] <input> [--] [function]...

FLAGS:
-h, --help                    Prints help information
--snip-rust-fmt-code          Snip Rust's `std::fmt` and `core::fmt` code.
--snip-rust-panicking-code    Snip Rust's `std::panicking` and `core::panicking` code.
-V, --version                 Prints version information

OPTIONS:
-o, --output <output>         The path to write the output wasm file to. Defaults to stdout.
-p, --pattern <pattern>...    Snip any function that matches the given regular expression.

ARGS:
<input>          The input wasm file containing the function(s) to snip.
<function>...    The specific function(s) to snip. These must match exactly. Use the -p flag for fuzzy matching.

Library

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

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

See docs.rs/wasm-snip 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].