Crates.io | include_wit_macro |
lib.rs | include_wit_macro |
version | 0.1.3 |
source | src |
created_at | 2023-08-30 15:40:23.460736 |
updated_at | 2024-02-11 17:15:19.3199 |
description | Macro implementation for embedding WIT data into application binaries. |
homepage | |
repository | https://github.com/DouglasDwyer/include_wit |
max_upload_size | |
id | 959057 |
size | 6,093 |
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.
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:?}");
}
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.