vtx-format
vtx-format defines the proprietary binary container format (.vtx) used by the VTX plugin system.
It is responsible for encapsulating standard WebAssembly Components (.wasm) into VTX plugin packages equipped with a Magic Header and version control. This ensures that the runtime loads only valid and version-compatible plugins.
Specification
Currently, only the V1 format is supported. All multibyte integers are stored in Big-Endian (Note: The current version only involves a single-byte version number, so endianness handling is not yet required).
V1 Structure Layout
The file header is fixed at 4 bytes, immediately followed by the raw Wasm Component byte stream.
| Offset | Length (Bytes) | Field | Value / Description |
|---|---|---|---|
| 0x00 | 3 | Magic Prefix | 0x56 0x54 0x58 (ASCII: "VTX") |
| 0x03 | 1 | Version | 0x01 (Current Version) |
| 0x04 | N | Payload | Raw WebAssembly Component binary data |
Installation
Add the following to your Cargo.toml:
[]
= "0.1"
Usage
Encoding
Encapsulate raw Wasm bytes into the .vtx format:
use encode_v1;
Decoding
Parse a .vtx file and verify the header:
use ;
Error Handling
The library provides the VtxFormatError enum to handle parsing errors:
TooShort: Data length is less than 4 bytes.InvalidPrefix: Header is not "VTX".UnsupportedVersion(u8): Encountered an unknown version number.
License
MIT License