vtx-protocol 0.2.1

The official WIT interface definitions for VTX plugins
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 1 items with examples
  • Size
  • Source code size: 5.66 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Hellohistory

vtx-protocol

Crates.io Docs

Official WIT interface definitions for VTX Project plugins.

This crate serves as the Single Source of Truth (SSOT) for the VTX plugin interface. It embeds the vtx.wit definition directly into your compiled binary or build process, eliminating the need to manually copy or manage .wit files.

Installation

Add this to your Cargo.toml:

[dependencies]
vtx-protocol = "1.2.0"
wit-bindgen = "0.25.0" # Ensure compatibility with the WIT version

Usage

Using with wit-bindgen

Instead of pointing wit-bindgen to a local file path, you can use the exported WIT_CONTENT constant. This ensures your plugin is always built against the exact version of the protocol defined in Cargo.toml.

use vtx_protocol::WIT_CONTENT;

wit_bindgen::generate!({
    // Use the embedded WIT string directly
    inline: WIT_CONTENT,
    world: "plugin",
    // Optional: Configure ownership model
    ownership: Borrowing {
        duplicate_if_necessary: true
    }
});

struct MyPlugin;

export!(MyPlugin);

impl Guest for MyPlugin {
    fn handle(req: HttpRequest) -> HttpResponse {
        // Implementation...
    }
}

Accessing Raw Files (Advanced)

If you need the physical path to the WIT file (e.g., for build scripts), use the helper function:

// Returns the PathBuf to the bundled vtx.wit file
let wit_path = vtx_protocol::get_wit_path();

Versioning

This crate follows Semantic Versioning.

  • Major.Minor.Patch corresponds strictly to the version of the vtx:api interface.