vtx_format/lib.rs
1//! vtx-format:统一定义 `.vtx` 包格式(编码/解码)。
2//! ## v1
3//! - Header: 4 bytes = `b"VTX\x01"`
4//! - Payload: WebAssembly Component bytes
5//!
6//! ## v2
7//! - Header: 4 bytes = `b"VTX\x02"`
8//! - Metadata length: 4 bytes (u32 little-endian)
9//! - Metadata: UTF-8 JSON bytes (length = metadata length)
10//! - Payload: WebAssembly Component bytes
11
12mod constants;
13mod decode;
14mod encode;
15mod error;
16mod types;
17
18pub use constants::{VTX_MAGIC_V1, VTX_MAGIC_V2, VTX_PREFIX, VTX_VERSION_V1, VTX_VERSION_V2};
19pub use decode::{decode, decode_with_metadata};
20pub use encode::{encode_v1, encode_v2};
21pub use error::VtxFormatError;
22pub use types::{DecodeWithMetadataResult, DecodedVtx};
23
24#[cfg(test)]
25mod tests;