Fix minor issues pointed out in the review

This commit is contained in:
Isaac Clayton 2022-07-11 15:54:03 +02:00
parent 3ad8d5363c
commit ec327a30c3
17 changed files with 293 additions and 270 deletions

View file

@ -31,6 +31,7 @@ All functions that Plugin exports must have the following properties:
Additionally, Plugin must export an:
- `__alloc_buffer` function that, given a `u32` length, returns a `u32` pointer to a buffer of that length.
- `__free_buffer` function that, given a buffer encoded as a `u64`, frees the buffer at the given location, and does not return anything.
Note that all of these requirements are automatically fullfilled for any Rust Wasm plugin that uses the `plugin` crate, and imports the `prelude`.

View file

@ -4,8 +4,8 @@ use wasmtime::{Config, Engine};
fn main() {
let base = Path::new("../../plugins");
// println!("cargo:rerun-if-changed=../../plugins/*");
println!("cargo:warning=Precompiling plugins...");
println!("cargo:rerun-if-changed={}", base.display());
println!("cargo:warning=Rebuilding precompiled plugins...");
let _ = std::fs::remove_dir_all(base.join("bin"));
let _ =

View file

@ -16,7 +16,9 @@ use wasmtime_wasi::{Dir, WasiCtx, WasiCtxBuilder};
/// Represents a resource currently managed by the plugin, like a file descriptor.
pub struct PluginResource(u32);
#[repr(C)]
/// This is the buffer that is used Host side.
/// Note that it mirrors the functionality of
/// the `__Buffer` found in the `plugin/src/lib.rs` prelude.
struct WasiBuffer {
ptr: u32,
len: u32,