#wasm-binary #wit #wasm-interface #applications #embedding #data #run-time

include_wit

Macro for embedding WIT data into application binaries

4 releases

0.1.3 Feb 11, 2024
0.1.2 Aug 30, 2023
0.1.1 Aug 30, 2023
0.1.0 Aug 30, 2023

#1527 in WebAssembly

21 downloads per month

MIT/Apache

7KB

include_wit

Crates.io Docs.rs Unsafe Forbidden

include_wit allows for embedding wit_parser::Resolve instances into an application binary. It exposes a single macro which parses a WIT file or directory, and generates a WASM binary to include in the source code. This WASM binary is then parsed at runtime upon first access.

Usage

The following is a simple example of how to use include_wit. The full example may be found in the examples folder.

// Embed the WIT folder into this application
let resolve = include_wit::include_wit!("wit");

// Print all interfaces in the resolve
for x in &resolve.interfaces {
    println!("{x:?}");
}

Optional features

relative_path (requires nightly) - Makes all included WIT paths relative to the file where the macro is invoked.

track_path (requires nightly) - Tracks the included WIT files for changes, causing recompilation automatically when they are edited.

Dependencies

~9MB
~161K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy