# vexil-runtime
Rust runtime for code generated by the [Vexil](https://github.com/vexil-lang/vexil) schema compiler. You don't use this crate directly -- it's a dependency of generated code. Add it alongside [`vexil-codegen-rust`](https://crates.io/crates/vexil-codegen-rust).
## Contents
| `BitWriter` / `BitReader` | LSB-first bit-level I/O. A `u3` field reads and writes exactly 3 bits. |
| `Pack` / `Unpack` | Traits implemented by generated structs and enums. |
| `leb128` | Unsigned and signed LEB128 variable-length integer encoding. |
| `zigzag` | ZigZag encoding for signed integers (`i32`/`i64` -> unsigned). |
| `DecodeError` / `EncodeError` | Structured error types for wire failures. |
## Wire format
Fields are packed LSB-first, left-to-right within each byte. No padding between fields. The byte stream is only padded to byte alignment at the end of a message.
A `u4` followed by a `u4` occupies exactly 1 byte. A `u5` followed by a `u4` occupies 2 bytes (9 bits, padded to 16).
## Safety limits
- Max recursion depth: 64 (encode and decode)
- Max byte array / string length: 16 MiB
- Max collection count: 1,048,576 elements
## License
Licensed under either of [MIT](../../LICENSE-MIT) or [Apache-2.0](../../LICENSE-APACHE) at your option.